用X-Cube-Ble2实施Freertos 2

发布于 2025-02-11 01:43:47 字数 1564 浏览 3 评论 0原文

我正在尝试使用X-Nucleo-BNRG2A1盾牌中的Freertos应用程序实现BLE任务。我在没有Freertos的情况下完成了BLE应用程序(X-Cube-Ble2软件包),并且运行良好。为了实现弗雷托斯,我一直在研究ble_heartratefreertos示例以供参考。看起来HCI_USER_EVT_PROC()函数在BLE_HEARTRATEFREERTOS示例和X-Cube-Ble2默认示例中有所不同。 BLE_HEARTRATEFREERTOS HCI_USER_EVT_PROC()具有以下注释:

/**

  * Up to release version v1.2.0, a while loop was implemented to read out events from the queue as long as

  * it is not empty. However, in a bare metal implementation, this leads to calling in a "blocking" mode

  * hci_user_evt_proc() as long as events are received without giving the opportunity to run other tasks

  * in the background.

  * From now, the events are reported one by one. When it is checked there is still an event pending in the queue,

  * a request to the user is made to call again hci_user_evt_proc().

  * This gives the opportunity to the application to run other background tasks between each event.

  */

此外,HCI_USER_EVT_PROC()函数在HCIUSEREVETPROCESS()任务中都在等待线程标志的HCIUSEREVTPROCESS()任务中调用。该线程标志是从HCI_NOTIFY_ASYNCH_EVT回调函数调用的。看起来HCI_NOTIFY_ASYNCH_EVT功能也与X-Cube-Ble2软件包不同。仅供参考:

static void HciUserEvtProcess(void *argument)

{

 UNUSED(argument);

 

 for(;;)

 {

  osThreadFlagsWait( 1, osFlagsWaitAny, osWaitForever);

  hci_user_evt_proc( );

 }

}

 

void hci_notify_asynch_evt(void* pdata)

{

 UNUSED(pdata);

 osThreadFlagsSet( HciUserEvtProcessId, 1 );

 return;

}

我的问题是,随着库文件不同,我如何用X-Nucleo-Ble2软件包实现Freertos。我是否应该在具有相同优先级的其他任务的任务中包含HCI_USER_EVT_PROC(),以便不会阻止其他任务?还是我缺少更新?

寻找专家有帮助。

I'm trying to implement a BLE task in my FreeRTOS application with the X-Nucleo-BNRG2A1 shield. I completed the BLE application (X-Cube-BLE2 package) without FreeRTOS and it has been working fine. For implementing the FreeRTOS, I have been looking into the BLE_HeartRateFreeRTOS example for reference. It looks like the hci_user_evt_proc() function is different in the BLE_HeartRateFreeRTOS example and the X-Cube-BLE2 default example. The BLE_HeartRateFreeRTOS hci_user_evt_proc() has a the following comment:

/**

  * Up to release version v1.2.0, a while loop was implemented to read out events from the queue as long as

  * it is not empty. However, in a bare metal implementation, this leads to calling in a "blocking" mode

  * hci_user_evt_proc() as long as events are received without giving the opportunity to run other tasks

  * in the background.

  * From now, the events are reported one by one. When it is checked there is still an event pending in the queue,

  * a request to the user is made to call again hci_user_evt_proc().

  * This gives the opportunity to the application to run other background tasks between each event.

  */

Moreover, the hci_user_evt_proc() function is called inside the HciUserEvtProcess() task where it waits for a Thread Flag. The Thread Flag is called from hci_notify_asynch_evt callback function. It looks like the hci_notify_asynch_evt function is also different from the X-Cube-BLE2 package. FYI:

static void HciUserEvtProcess(void *argument)

{

 UNUSED(argument);

 

 for(;;)

 {

  osThreadFlagsWait( 1, osFlagsWaitAny, osWaitForever);

  hci_user_evt_proc( );

 }

}

 

void hci_notify_asynch_evt(void* pdata)

{

 UNUSED(pdata);

 osThreadFlagsSet( HciUserEvtProcessId, 1 );

 return;

}

My question is, how do I implement FreeRTOS with my X-Nucleo-BLE2 package as the library files are different. Should I include the hci_user_evt_proc() inside a task with same priority with the other tasks so that other tasks will not be blocked? Or is there an update that I'm missing?

Looking for expert helps.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文