Part Number: CC1352R
Other Parts Discussed in Thread: SYSBIOS
Tool/software: Code Composer Studio
Hello,
I have some doubts concerning sysbios event module. I'm trying to wake up my project every X seconds using a clock module. Inside clock callback, there is an Event_post in order to "unlock" a fsmThread pending on the relative event-mask.
This is my example code for Clock:
void *mainClockThread(void *arg0){
Clock_Params clkParams;
Clock_Params_init(&clkParams);
clkParams.period = 60000000/Clock_tickPeriod;
clkParams.startFlag = TRUE;
Clock_construct(&clk0Struct,(Clock_FuncPtr) clkFxn,60000000/Clock_tickPeriod, &clkParams);
}
void clkFxn(UArg arg0){
x = Seconds_get();
GPIO_toggle(Board_GPIO_LED0);
Event_post(myEvent, WAKE_UP_EVENT);
}
While the fsmThread code :
while(1){
event = Event_pend(myEvent, 0, WAKE_UP_EVENT, BIOS_WAIT_FOREVER);
if ( event & WAKE_UP_EVENT)
nextState = FSM_STATE_Toggle;
else
nextState = FSM_STATE_Idle;
switch (nextState) {
case FSM_STATE_Idle:
// do nothing
break;
case FSM_STATE_Toggle:
// post the event
Event_post(myEvent, TOGGLE_EVENT);
nextState = FSM_STATE_Print;
break;
case FSM_STATE_Print:
// post the event
Event_post(myEvent, PRINT_EVENT);
nextState = FSM_STATE_Idle;
break;
default:
break;
}
b = false;
usleep(100);
}
Where toggleEvent and printEvent awake two different threads that toggle a led and print something on display_uart.
With Event_post() inside of clkFxn nothing works. Is it possible to use it inside the clockCallback? If I check postedEvents value inside the myEvent struct during the clockCallback I get the correct value but the toggleThread does not start at all. Do you have any idea why?
Regards,
Vincenzo



