HAL_UART functions do not work with Azure RTOS ThreadX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-24 10:20 AM
Hello,
I followed this guide:
https://community.st.com/s/article/how-does-the-threadx-semaphore-work
And everything works.
But when I try to add a modification, a HAL_UART_Transmit - HAL_UART_Transmit(&huart2, (uint8_t *)&message, 1, 10); - in one thread I always get the error 'huart2' undeclared. Well huart2 is declared in my main.c but of course not in the app_thread.c. And there are my threads.
So my question is how can I solve this error? With FreeRTOS I just created threads and all the code in my main.c so there was no issue to use HAL_UART. But I am not sure how to solve it on ThreadX?
Solved! Go to Solution.
- Labels:
-
AzureRTOS
-
FreeRTOS
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-25 7:19 PM
extern UART_HandleTypeDef huart2;
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-24 10:43 AM
The same for HAL_GPIO_WritePin or HAL_GPIO_TogglePin.. I am not able to use them with Azure RTOS in the threads in the app_threadx.c file. Is there a way to be able to use them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-24 3:20 PM
I get the same error. So the fix was to add #include "main.h" to the app_threadx.c file
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-25 5:02 AM
Thank you @Community member​ this solved the problem with the LEDs, the HAL_GPIO_WritePin or HAL_GPIO_TogglePin works. But still the HAL_UART_Transmit function does not work in the app_threadx.c file. Do you know how to solve this too?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-25 8:15 AM
Well "HAL_UART_Transmit function does not work" is kind of vague. You need to describe the issue in more detail.
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-25 5:32 PM
So I followed this guide:
https://community.st.com/s/article/how-does-the-threadx-semaphore-work
And everything works as expected.
But I wanted to modify the example. I added in my app_threadx.c file in my threads the
HAL_UART_Transmit and HAL_UART_Receive functions. I initialized the uart in the CubeMX configurations so its in there.
But the problem I face is the following: Since I add all my code in the app_threadx.c and so my uart transmit and receive functions in my threads I get the error when I try to build: 'huart2' undeclared - The uart2 is declared in my main.c file but not in the app_threadx.c.
So how can I use uart transmit and uart receive in my threads?
With FreeRTOS it was straight forward, as I did all the code in the main.c so I could use the uart transmit and receive functions in my threads out of the box as it was all in the main.c file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-25 7:19 PM
extern UART_HandleTypeDef huart2;
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
