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!
Besides, if I set the timer period too small ,like 1ms, then other threads don't work anymore.
I use the hardware timer independently, RTX timer tick is 1000us or 100us which I both tried. The cpu clock is 120MHz.
what should I do , if a fast hardware counter is needed in CMSIS-RTX ? thank a lot.