We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The problem is similar to http://www.keil.com/forum/9257/ . I don't know whether it was solved.
when I call osSemaphoreWait(), the returned value is 0xFFFFFFFF (-1) , which is happened when I use hardware timer independently. The code is showing below,
int32_t sem; osSemaphoreId rl_sem[1]; osSemaphoreDef(sem_0); //user thread 1 Thread() { rl_sem[0]=osSemaphoreCreate(osSemaphore(sem_0),1); while(1) { ... sem = osSemaphoreWait(rl_sem[0],0); printf("sem=%d",sem); //sem normally should be 1, but here it is 0xFFFFFFFF, ie, -1 } } //CAN ISR CAN_IRQHandler() { ... osSemaphoreRelease(rl_sem[0]); } //timer ISR Timer_Callback() { // nothing to do with semaphore }
your advice is much appreciated!
yeah,the returned of osSemaphoreCreate is ok, for when no hardware time is used, it works normally. the return value of osSemaphoreRelease(rl_sem[0]) is 0,which means osOK.
Just when I use hardware timer, the return value of osSemaphoreWait is -1.
My cpu is MK64F12,and I use PIT timer. thank you!