2014-06-13 01:50 PM
I think I am having some trouble setting up RTX on the STM3240G-EVAL (STM32F4 series). I have (supposedly) configured the timer for a 1 ms tick rather than the default 10 ms. I have a task that supposedly turns on an LED for 10 ms then turns it off for 990 ms, and does this repeatedly. This is the code I have used:
#include <stm32f4xx.h>#include <RTL.h>#include ''LED.h''/** * Pulses LED1 for 10 ms at the top of every second */__task void sendPulse(void) { while (1) { LED_On(3); os_dly_wait(10); LED_Off(3); os_dly_wait(990); }}/** * Initializes everything */__task void init(void) { LED_Init(); os_tsk_create(sendPulse, 4);}int main() { os_sys_init(init); while(1);}However the LED is never turning off. I checked in the debugger and it is getting stuck on os_dly_wait(). I had a similar issue a while ago while using the HAL code that comes with STM32Cube that was solved by adding the line ''HAL_IncTick()'' to the SysTickHandler. I do not see as obvious a solution to my current problem. Does anyone have any suggestions?2014-06-13 02:13 PM
I was able to figure this out. os_dly_wait() pauses the calling task. In this case, the callee was sendPulse() while the caller was init(). In init(), after creating the task for sendPulse(), the task completes so therefore when os_dly_wait() is called there is nothing left to pause. By adding an infinite loop after creating the task for sendPulse() you can solve the issue.