国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

RT-Thread STM32L431 Bear-Pi開發(fā)板BSP說明

這篇具有很好參考價值的文章主要介紹了RT-Thread STM32L431 Bear-Pi開發(fā)板BSP說明。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

RT-Thread STM32L431 Bear-Pi開發(fā)板BSP說明

bsp源碼下載,stm32,linux,arm開發(fā),運維,嵌入式硬件,單片機(jī)

簡介

本文檔為Bear-Pi 開發(fā)板的 BSP (板級支持包) 說明。

主要內(nèi)容如下:

  • 開發(fā)板資源介紹
  • BSP 快速上手
  • 進(jìn)階使用方法

通過閱讀快速上手章節(jié)開發(fā)者可以快速地上手該 BSP,將 RT-Thread 運行在開發(fā)板上。在進(jìn)階使用指南章節(jié),將會介紹更多高級功能,幫助開發(fā)者利用 RT-Thread 驅(qū)動更多板載資源。

開發(fā)板介紹

對于 Bear-Pi,內(nèi)核是 Cortex-M4,這款芯片是低功耗系列,板載 ST-LINK/V2-1 調(diào)試器/編程器,迷你尺寸,mirco USB 接口,可數(shù)的外設(shè),Arduino? nano 兼容的接口。

開發(fā)板外觀如下圖所示:
bsp源碼下載,stm32,linux,arm開發(fā),運維,嵌入式硬件,單片機(jī)

該開發(fā)板常用 板載資源 如下:

  • MCU:STM32L431RC,主頻 80MHz,256KB FLASH ,64KB RAM。
  • 常用外設(shè)
    • SPI FLASH: 8M
    • 按鍵:2個功能鍵,一個復(fù)位按鍵。
    • 支持E53系列傳感器案例擴(kuò)展板
    • LCD: 240 * 240 tft
    • LED:一個用戶LED, 上電指示燈,下載燈。
  • 常用接口:USB 支持 3 種不同接口:虛擬 COM 端口、大容量存儲和調(diào)試端口。
  • 調(diào)試接口:板載 ST-LINK/V2-1 調(diào)試器。

開發(fā)板更多詳細(xì)信息請參考【Bear-Pi 官網(wǎng)】 Bear-Pi。

外設(shè)支持

本 BSP 目前對外設(shè)的支持情況如下:

板載外設(shè) 支持情況 備注
板載 ST-LINK 轉(zhuǎn)串口 支持 UART1
片上外設(shè) 支持情況 備注
GPIO 支持 PA0, PA1… PC15 —> PIN: 0, 1…47
UART 支持 UART1

使用說明

使用說明分為如下兩個章節(jié):

  • 快速上手

    本章節(jié)是為剛接觸 RT-Thread 的新手準(zhǔn)備的使用說明,遵循簡單的步驟即可將 RT-Thread 操作系統(tǒng)運行在該開發(fā)板上,看到實驗效果 。

  • 進(jìn)階使用

    本章節(jié)是為需要在 RT-Thread 操作系統(tǒng)上使用更多開發(fā)板資源的開發(fā)者準(zhǔn)備的。通過使用 ENV 工具對 BSP 進(jìn)行配置,可以開啟更多板載資源,實現(xiàn)更多高級功能。

快速上手

本 BSP 為開發(fā)者提供 MDK5 和 IAR 工程,并且支持 GCC 開發(fā)環(huán)境。下面以 MDK5 開發(fā)環(huán)境為例,介紹如何將系統(tǒng)運行起來。

硬件連接

使用數(shù)據(jù)線連接開發(fā)板到 PC,打開電源開關(guān)。

編譯下載

雙擊 project.uvprojx 文件,打開 MDK5 工程,編譯并下載程序到開發(fā)板。

工程默認(rèn)配置使用 ST-LINK 仿真器下載程序,在通過 microUSB 連接開發(fā)板的基礎(chǔ)上,點擊下載按鈕即可下載程序到開發(fā)板

運行結(jié)果

下載程序成功之后,系統(tǒng)會自動運行,觀察開發(fā)板上 LED 的運行效果,紅色 D5、藍(lán)色 LED 會周期性閃爍。

USB 虛擬 COM 端口默認(rèn)連接串口 1,在終端工具里打開相應(yīng)的串口(115200-8-1-N),復(fù)位設(shè)備后,可以看到 RT-Thread 的輸出信息:

 \ | /
- RT -     Thread Operating System
 / | \     4.0.3 build Dec 28 2020
 2006 - 2020 Copyright by rt-thread team
---Welcome use BearPi---
msh >

進(jìn)階使用

此 BSP 默認(rèn)只開啟了 GPIO 和 串口2 的功能,如果需使用更多高級功能,需要利用 ENV 工具對 BSP 進(jìn)行配置,步驟如下:

  1. 在 bsp 下打開 env 工具。

  2. 輸入menuconfig命令配置工程,配置好之后保存退出。

  3. 輸入pkgs --update命令更新軟件包。

  4. 輸入scons --target=mdk4/mdk5/iar 命令重新生成工程。

本章節(jié)更多詳細(xì)的介紹請參考 STM32 系列 BSP 外設(shè)驅(qū)動使用教程。

注意事項

  • 開機(jī)時如果不能打印 RT-Thread 版本信息,請將BSP中串口 GPIO 速率調(diào)低
  • 開機(jī)時如果不能打印 RT-Thread 版本信息,請重新選擇 PC 端串口調(diào)試軟件的串口號

示例代碼

…\rt-threadcode\src\ipc.c


/**
 * @brief    This function will try to take a mutex, if the mutex is unavailable, the thread returns immediately.
 *
 * @note     This function is very similar to the rt_mutex_take() function, when the mutex is not available,
 *           except that rt_mutex_trytake() will return immediately without waiting for a timeout
 *           when the mutex is not available.
 *           In other words, rt_mutex_trytake(mutex) has the same effect as rt_mutex_take(mutex, 0).
 *
 * @see      rt_mutex_take()
 *
 * @param    mutex is a pointer to a mutex object.
 *
 * @return   Return the operation status. ONLY When the return value is RT_EOK, the operation is successful.
 *           If the return value is any other values, it means that the mutex take failed.
 */
rt_err_t rt_mutex_trytake(rt_mutex_t mutex)
{
    return rt_mutex_take(mutex, RT_WAITING_NO);
}
RTM_EXPORT(rt_mutex_trytake);


/**
 * @brief    This function will release a mutex. If there is thread suspended on the mutex, the thread will be resumed.
 *
 * @note     If there are threads suspended on this mutex, the first thread in the list of this mutex object
 *           will be resumed, and a thread scheduling (rt_schedule) will be executed.
 *           If no threads are suspended on this mutex, the count value mutex->value of this mutex will increase by 1.
 *
 * @param    mutex is a pointer to a mutex object.
 *
 * @return   Return the operation status. When the return value is RT_EOK, the operation is successful.
 *           If the return value is any other values, it means that the mutex release failed.
 */
rt_err_t rt_mutex_release(rt_mutex_t mutex)
{
    rt_base_t level;
    struct rt_thread *thread;
    rt_bool_t need_schedule;

    /* parameter check */
    RT_ASSERT(mutex != RT_NULL);
    RT_ASSERT(rt_object_get_type(&mutex->parent.parent) == RT_Object_Class_Mutex);

    need_schedule = RT_FALSE;

    /* only thread could release mutex because we need test the ownership */
    RT_DEBUG_IN_THREAD_CONTEXT;

    /* get current thread */
    thread = rt_thread_self();

    level = rt_spin_lock_irqsave(&(mutex->spinlock));

    LOG_D("mutex_release:current thread %s, hold: %d",
          thread->parent.name, mutex->hold);

    RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mutex->parent.parent)));

    /* mutex only can be released by owner */
    if (thread != mutex->owner)
    {
        thread->error = -RT_ERROR;
        rt_spin_unlock_irqrestore(&(mutex->spinlock), level);

        return -RT_ERROR;
    }

    /* decrease hold */
    mutex->hold --;
    /* if no hold */
    if (mutex->hold == 0)
    {
        /* remove mutex from thread's taken list */
        rt_list_remove(&mutex->taken_list);

        /* whether change the thread priority */
        if ((mutex->ceiling_priority != 0xFF) || (thread->current_priority == mutex->priority))
        {
            rt_uint8_t priority = 0xff;

            /* get the highest priority in the taken list of thread */
            priority = _thread_get_mutex_priority(thread);

            rt_thread_control(thread,
                              RT_THREAD_CTRL_CHANGE_PRIORITY,
                              &priority);

            need_schedule = RT_TRUE;
        }

        /* wakeup suspended thread */
        if (!rt_list_isempty(&mutex->parent.suspend_thread))
        {
            /* get the first suspended thread */
            struct rt_thread *next_thread = rt_list_entry(mutex->parent.suspend_thread.next,
                                   struct rt_thread,
                                   tlist);

            LOG_D("mutex_release: resume thread: %s",
                  next_thread->parent.name);

            rt_spin_lock(&(next_thread->spinlock));
            /* remove the thread from the suspended list of mutex */
            rt_list_remove(&(next_thread->tlist));

            /* set new owner and put mutex into taken list of thread */
            mutex->owner = next_thread;
            mutex->hold  = 1;
            rt_list_insert_after(&next_thread->taken_object_list, &mutex->taken_list);
            /* cleanup pending object */
            next_thread->pending_object = RT_NULL;
            rt_spin_unlock(&(next_thread->spinlock));
            /* resume thread */
            rt_thread_resume(next_thread);

            /* update mutex priority */
            if (!rt_list_isempty(&(mutex->parent.suspend_thread)))
            {
                struct rt_thread *th;

                th = rt_list_entry(mutex->parent.suspend_thread.next,
                        struct rt_thread,
                        tlist);
                mutex->priority = th->current_priority;
            }
            else
            {
                mutex->priority = 0xff;
            }

            need_schedule = RT_TRUE;
        }
        else
        {
            /* clear owner */
            mutex->owner    = RT_NULL;
            mutex->priority = 0xff;
        }
    }

    rt_spin_unlock_irqrestore(&(mutex->spinlock), level);

    /* perform a schedule */
    if (need_schedule == RT_TRUE)
        rt_schedule();

    return RT_EOK;
}
RTM_EXPORT(rt_mutex_release);


/**
 * @brief    This function will set some extra attributions of a mutex object.
 *
 * @note     Currently this function does not implement the control function.
 *
 * @param    mutex is a pointer to a mutex object.
 *
 * @param    cmd is a command word used to configure some attributions of the mutex.
 *
 * @param    arg is the argument of the function to execute the command.
 *
 * @return   Return the operation status. When the return value is RT_EOK, the operation is successful.
 *           If the return value is any other values, it means that this function failed to execute.
 */
rt_err_t rt_mutex_control(rt_mutex_t mutex, int cmd, void *arg)
{
    /* parameter check */
    RT_ASSERT(mutex != RT_NULL);
    RT_ASSERT(rt_object_get_type(&mutex->parent.parent) == RT_Object_Class_Mutex);

    return -RT_ERROR;
}
RTM_EXPORT(rt_mutex_control);

/**@}*/
#endif /* RT_USING_MUTEX */

源碼下載

…\bsp\stm32\stm32l431-BearPi\project.uvproj

bsp源碼下載,stm32,linux,arm開發(fā),運維,嵌入式硬件,單片機(jī)


RT-Thread STM32L431 Bear-Pi開發(fā)板BSP說明 源碼下載文章來源地址http://www.zghlxwxcb.cn/news/detail-763863.html


維護(hù)人:

  • 華為奮斗者精神, 郵箱:1992152446@qq.com

到了這里,關(guān)于RT-Thread STM32L431 Bear-Pi開發(fā)板BSP說明的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 【STM32&RT-Thread零基礎(chǔ)入門】 2. 新建RT-Thread項目

    【STM32&RT-Thread零基礎(chǔ)入門】 2. 新建RT-Thread項目

    硬件:STM32F103ZET6、ST-LINK、usb轉(zhuǎn)串口工具 RT-Thread的全稱是Real Time Thread,顧名思義,它是一個嵌入式實時多線程操作系統(tǒng)。相較于 Linux 操作系統(tǒng),RT-Thread 體積小,成本低,功耗低、啟動快速,除此之外 RT-Thread 還具有實時性高、占用資源小等特點,非常適用于各種資源受限(

    2024年02月13日
    瀏覽(25)
  • 使用RT-Thread Studio搭配STM32CubeMX新建RT-Thread項目

    使用RT-Thread Studio搭配STM32CubeMX新建RT-Thread項目

    STM32CubeMX下載 RT-Thread Studio下載 安裝好RT-Thread Studio后,先打開RT-Thread SDK管理器確認(rèn)有沒有自己MCU需要的SDK包,直接安裝好之后里面是有STM32F1系列的SDK包,其他的需要自己安裝。 之后點擊文件→新建→RT-Thread項目,根據(jù)自己需要配置好后點擊完成就會生成RT-Thread項目。 新建項

    2024年02月11日
    瀏覽(21)
  • 【STM32&RT-Thread零基礎(chǔ)入門】8. 基于 CubeMX 移植 RT-Thread Nano

    【STM32&RT-Thread零基礎(chǔ)入門】8. 基于 CubeMX 移植 RT-Thread Nano

    硬件:STM32F103ZET6、ST-LINK、usb轉(zhuǎn)串口工具、4個LED燈、1個蜂鳴器、4個1k電阻、2個按鍵、面包板、杜邦線 利用RT_Thread操作系統(tǒng)實現(xiàn)三種不同的LED等閃爍 提示:以下是本篇文章正文內(nèi)容,下面案例可供參考 cubemx配置參考教程: 基于 CubeMX 移植 RT-Thread Nano 后面程序所需的引腳 RT

    2024年02月09日
    瀏覽(30)
  • STM32 + RT-Thread + LwIp + DM9000

    STM32 + RT-Thread + LwIp + DM9000

    開發(fā)板:STM32F103ZET6(戰(zhàn)艦) RT-Thread:5.0.0 LwIp:2.1.2 網(wǎng)卡芯片:DM9000 編譯環(huán)境:keil 我簡單了解了一下,在嵌入式中,網(wǎng)絡(luò)芯片的使用方式大致有三種,如下: (MCU + MAC + PHY) (MUC + MAC) —— PHY MCU —— (MAC + PHY) 注意: 我用括號里面的表示在同一塊芯片中 移植 RT-Thread 不是此文

    2024年02月07日
    瀏覽(59)
  • 【STM32&RT-Thread零基礎(chǔ)入門】 4. 線程介紹(理論)

    【STM32&RT-Thread零基礎(chǔ)入門】 4. 線程介紹(理論)

    前文中的最后一個任務(wù)發(fā)現(xiàn),一個main()函數(shù)很難同時實現(xiàn)按鍵功能和閃燈功能,就好像人很難同時完成左手畫圓右手畫方一樣,這種情況可以安排一人去畫圓、一人去畫方,并行進(jìn)行就很容易了,兩人各司其職,互不干擾。 操作系統(tǒng)中,一個線程就像做事的一個人。一個操作

    2024年02月12日
    瀏覽(18)
  • RT-Thread:STM32實時時鐘 RTC開啟及應(yīng)用

    RT-Thread:STM32實時時鐘 RTC開啟及應(yīng)用

    說明: STM32F103/407系列基于 RT-Thread 系統(tǒng)的 RTC 開啟及應(yīng)用 應(yīng)用流程介紹。 完成以上系統(tǒng)配置,編譯無誤情況下RTC 就已經(jīng)開啟了。 官方 API 查詢地址:https://www.rt-thread.org/document/api/rtc_sample_8c-example.html#a3 1.設(shè)置日期:設(shè)置系統(tǒng)日期但不修改時間 2.設(shè)置時間:設(shè)置系統(tǒng)時間但不

    2024年01月17日
    瀏覽(26)
  • STM32CubeMX+VSCODE+EIDE+RT-THREAD 工程創(chuàng)建

    STM32CubeMX+VSCODE+EIDE+RT-THREAD 工程創(chuàng)建

    ????????Eide環(huán)境搭建暫且不表,后續(xù)補(bǔ)充。主要記錄下Vscode環(huán)境下 創(chuàng)建Rt-thread工程的過程。分別介紹STM32CubeMX添加rtt支持包的方式和手動添加rtt kernel方式。STM32CubeMX生成工程的時候有\(zhòng)\\"坑\\\",防止下次忘記,方便渡一下有緣人,特此記錄。 ? ? ? ? 此工程以創(chuàng)建stm32f405為例

    2024年02月14日
    瀏覽(27)
  • RT-Thread STM32 GoKit V2.1 開發(fā)板BSP說明

    RT-Thread STM32 GoKit V2.1 開發(fā)板BSP說明

    本文檔為劉恒為 GoKit V2.1 開發(fā)板提供的 BSP (板級支持包) 說明。 主要內(nèi)容如下: 開發(fā)板資源介紹 BSP 快速上手 進(jìn)階使用方法 通過閱讀快速上手章節(jié)開發(fā)者可以快速地上手該 BSP,將 RT-Thread 運行在開發(fā)板上。在進(jìn)階使用指南章節(jié),將會介紹更多高級功能,幫助開發(fā)者利用 RT-

    2024年02月04日
    瀏覽(23)
  • 基于stm32單片機(jī)和rt-thread操作系統(tǒng)的智能燈

    基于stm32單片機(jī)和rt-thread操作系統(tǒng)的智能燈

    目????錄 一、 總體概況 二、 各部分介紹 2.1??STM32F4開發(fā)板 2.2??光敏模塊 2.3 ?麥克風(fēng)模塊 2.4??超聲波模塊 三、 RT-Thread介紹 四、 開發(fā)過程 五、 未來設(shè)想 六、 開發(fā)心得 總體概況 本次測試技術(shù)與信號處理課程作業(yè),我利用了stm32單片機(jī)和rt-thread實時操作系統(tǒng)進(jìn)行實踐。

    2023年04月16日
    瀏覽(21)
  • 【STM32&RT-Thread零基礎(chǔ)入門】 7. 線程創(chuàng)建應(yīng)用(多線程運行機(jī)制)

    【STM32&RT-Thread零基礎(chǔ)入門】 7. 線程創(chuàng)建應(yīng)用(多線程運行機(jī)制)

    硬件:STM32F103ZET6、ST-LINK、usb轉(zhuǎn)串口工具、4個LED燈、1個蜂鳴器、4個1k電阻、2個按鍵、面包板、杜邦線 本章進(jìn)一步研究多線程的運行機(jī)制。要求實現(xiàn)功能如下:創(chuàng)建2個線程,線程名稱分別為LED和BEEP。兩個線程的任務(wù)是連續(xù)5次打印本線程的名字后退出線程(注意:線程不執(zhí)行

    2024年02月03日
    瀏覽(30)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包