2022-01-11 12:45 PM
I am trying to get Azure-RTOS/ThreadX running on a STM32F4-DISCOVERY board.
I generally followed the instructions from https://community.st.com/s/article/how-to-create-a-thread-using-azurertos-and-stm32cubeide except:
- I (obviously) picked a different board in CubeMX
- I used TIM11 for HAL timebase
- I picked X-CUBE-AZRTOS-F4 instead of X-CUBE-AZRTOS-F7
- my task only increments a counter instead of flashing a LED.
It all compiles and my task starts. However, when it calls tx_thread_sleep(), it never returns. The scheduler is stuck in the __tx_ts_wait loop.
The SysTick is configured properly and running. However, as far as I can tell, the SysTick handler never gets called.
Am I doing anything wrong? Are there any ThreadX examples for STM32F411 available?
Thanks!
Bart
2022-01-13 05:26 AM
Hello @BKlus.1 ,
You can refer to the following example provided under the X-CUBE-AZRTOS-F4 package:
This might help you.
BeST Regards,
Walid
2022-01-22 12:41 PM
Thank you! The linked example helped me confirm that I was not doing anything seriously wrong.
The problem was that the priority grouping was wrong, with all four bits used for subpriority and none at all for preemption priority. ThreadX depends on PnSV having the lowest preemption priority.
This is solved by either manually adding the following line before the MX_ThreadX_Init() call:
HAL_NVIC_SetPriorityGrouping( NVIC_PRIORITYGROUP_4 );
Alternatively, in CubeMX, System Core/NVIC/NVIC/ Priority Group can be set to "4 bits for pre-emption priority." By the way, I think it would be a good idea for this to be the default option when ThreadX is selected.
Thanks!
Bart
2024-09-23 08:20 PM
Hello Sir/Mam,
I am using stm32U073KCU6 with ThreadX/USBX & USART1 to deploy Virtual Com Port. But I get stuck at following step:
"__tx_ts_wait : Disable all interrupt"
I came across your post having same issue earlier. I do not have much idea about interrupts/priorities in stm32 but when I tried to use your function "HAL_NVIC_SetPriorityGrouping()" it does not work out since it is not available in stm32u0_cortex_hal file. STMcubeMX does not show "PriorityGroup" option either. I have attached my IOC file with this post. I would greatly appreciate your help in this matter.