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
ChibiOs stuck in chSchReadyI
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: ChibiOs stuck in chSchReadyI
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
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
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
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
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: ChibiOs stuck in chSchReadyI
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
Best regards,
Todor
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: ChibiOs stuck in chSchReadyI
The FatFs port does not do much except using a Semaphore, are stacks OK?
Giovanni
Giovanni
Re: ChibiOs stuck in chSchReadyI
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
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
Last edited by tmanev on Sat Nov 03, 2012 7:11 pm, edited 1 time in total.
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: ChibiOs stuck in chSchReadyI
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
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