Page 1 of 1
ChibiOs stuck in chSchReadyI
Posted: Fri Nov 02, 2012 9:25 am
by tmanev
ChibiOs stuck in function chSchReadyI: (chschd.c) because cp->p_prio = 0 and tp->p_prio = 0
do {
cp = cp->p_next;
} while (cp->p_prio >= tp->p_prio);
Any Idea why this happens?
I suspect that there is problem with :
chEvtSignalFlags and chEvtWaitOneTimeout
Or something gets very fast do not know what....
Best regards,
Todor
Re: ChibiOs stuck in chSchReadyI
Posted: Fri Nov 02, 2012 11:30 am
by Giovanni
Hi,
That can happen if some function is used incorrectly, for example trying to ready a thread that is already ready or similar. Make sure to enable debug options.
A stack overflow is less likely in this case but still possible.
Giovanni
Re: ChibiOs stuck in chSchReadyI
Posted: Fri Nov 02, 2012 3:07 pm
by tmanev
This is called in chSysTimerHandlerI which calls chSchReadyI.
Let me explain what I have to get a better idea I have two threads
1. the first does chEvtWaitOneTimeout
2. the second does chEvtSignalFlags the first one
3. the second goes to chEvtWaitOneTimeout waits for the first to signal it
4. the first wakes and does some work and then chEvtSignalFlags the second
The first time it works but if this happens again(1.2.3.4.) it goes to the stuck position.
The problem could be due to the use of fatfs ....... but still searching what is the problem
Todor
Re: ChibiOs stuck in chSchReadyI
Posted: Fri Nov 02, 2012 7:57 pm
by Giovanni
Are you running with the state checker enabled?
Giovanni
Re: ChibiOs stuck in chSchReadyI
Posted: Sat Nov 03, 2012 6:16 pm
by tmanev
Yes it is enabled, but still the same result. I suspect there is something in the fatfs port. Because in one of the threads I do fs_write if I remove it works......
Best regards,
Todor
Re: ChibiOs stuck in chSchReadyI
Posted: Sat Nov 03, 2012 6:41 pm
by Giovanni
The FatFs port does not do much except using a Semaphore, are stacks OK?
Giovanni
Re: ChibiOs stuck in chSchReadyI
Posted: Sat Nov 03, 2012 6:57 pm
by tmanev
Yes, it is the stack I made it bigger and is ok now.
How can I check the stack of each thread in IAR and also the call stack of the threads it could be very useful?
Todor
Re: ChibiOs stuck in chSchReadyI
Posted: Sat Nov 03, 2012 7:04 pm
by Giovanni
Good question

I would enable the stack filling option in chconf.h, let the program run and after it crashed check the filler in the various stacks (addresses from map files).
Giovanni