ChibiOs stuck in chSchReadyI

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
tmanev
Posts: 22
Joined: Thu Oct 04, 2012 8:57 am

ChibiOs stuck in chSchReadyI

Post 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
User avatar
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

Post 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
tmanev
Posts: 22
Joined: Thu Oct 04, 2012 8:57 am

Re: ChibiOs stuck in chSchReadyI

Post 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
User avatar
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

Post by Giovanni »

Are you running with the state checker enabled?

Giovanni
tmanev
Posts: 22
Joined: Thu Oct 04, 2012 8:57 am

Re: ChibiOs stuck in chSchReadyI

Post 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
User avatar
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

Post by Giovanni »

The FatFs port does not do much except using a Semaphore, are stacks OK?

Giovanni
tmanev
Posts: 22
Joined: Thu Oct 04, 2012 8:57 am

Re: ChibiOs stuck in chSchReadyI

Post 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
Last edited by tmanev on Sat Nov 03, 2012 7:11 pm, edited 1 time in total.
User avatar
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

Post 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
Post Reply