XMC4500 Timer Thread using CMSIS-RTOS not working

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hey there,

I've tried to use the (Software?) Timer from the RTOS, following the description in the documentation: http://www.keil.com/pack/doc/arm/cmsis/cmsis/documentation/rtos/html/group___c_m_s_i_s___r_t_o_s___t...
Including the necessary configurations in the UI for RTOS App.
But sadly the callback functions are never reached (neither in debug mode nor toggling LED). Does anybody have a minimal example wich works as it should?

Regards, Julian
0 Likes
3 Replies
Not applicable
Could anybody at least confirm the problem?
0 Likes
Not applicable
Hi Julian,

Did you enable the User Timer in the RTOS001 App?

Anyway, we will look into this issue.
Will update you once we have solution.
0 Likes
Not applicable
Hi Julian,

I can get the timer to run and get the callback function.
I'm not sure how you does it but basically how I did as follow:
1) Using the RTOS_Example1 from the DAVE3 and enable the "User Timers" in the RTOS001 UI Editor
2) Added IO004 for IO control in Callback function
3) Regenerated the code
4) Add new thread for create timer task and timer callback function

Definition:
osThreadId tid_thread3;               /* assigned ID for thread 3            */
void osTimer_thread (void const *argument);
void Timer1_Callback (void const *arg);
osThreadDef(osTimer_thread, osPriorityNormal, 1, 0);
osTimerDef (Timer1, Timer1_Callback);
uint32_t exec1;


Timer Thread:

void osTimer_thread (void const *argument)
{
osTimerId id1;
osStatus status;
uint32_t timerDelay;

exec1 = 1;
id1 = osTimerCreate (osTimer(Timer1), osTimerPeriodic, &exec1);
if (id1)
{
timerDelay = 1000;
status = osTimerStart (id1, timerDelay); // start timer
if (status != osOK)
{
// Timer could not be started
}
}
}


Timer Callback function:

void Timer1_Callback (void const *arg)
{
IO004_TogglePin(IO004_Handle0);
}


Main function:

int main (void) { /* program execution starts here */

DAVE_Init();
mpool = osPoolCreate(osPool(mpool)); /* create memory pool */
MsgBox = osMessageCreate(osMessageQ(MsgBox), NULL); /* create msg queue */

tid_thread1 = osThreadCreate(osThread(send_thread), NULL);
tid_thread2 = osThreadCreate(osThread(recv_thread), NULL);
tid_thread3 = osThreadCreate(osThread(osTimer_thread), NULL);

semaphore = osSemaphoreCreate(osSemaphore(semaphore), 1);

osKernelStart();

osDelay(osWaitForever);
for (;;);
}
0 Likes