Pumpkin, Inc.

Pumpkin User Forums

Task gets stopped by OS_Delay()

If you can't make Salvo do what you want it to do, post it here.

Task gets stopped by OS_Delay()

Postby JBevis » Fri Jun 28, 2002 6:45 am

I've been going in circles over a problem related (apparently) to OS_Delay. I have four tasks running, and two of these tasks have the following form:

task()
{
forever
{
do_something_useful;
OS_Delay(xxx,label);
}
}

Of the two tasks having this form, one invariably ends up hung. When this has occurred, OSRpt() says it's state is DLYD, and its delay value is 0:

Salvo 3.0.4 Ticks: 5111
EligQ: t2
DelayQ: t3,t4 Total delay: 22788 ticks
task stat prio addr t-> e->delay
1* elig 10 00008F5Bh t 2 n/a
2 elig 10 000091EDh . n/a
3 dlyd 10 000090D5h t 4 89 <--OK
4 dlyd 10 00005211h . 0 <--HUNG
5 elig 14 0000B1E9h n/a

I never do OS_Delay(0,label), so I am wondering how the task could get stopped.

It also appears that the task which is started first continues to run, but the one which is started second gets hung.

Any idea how this could happen?

(This is with Keil C51 and library slc51lxaa.)

------------------
Jeff Bevis
jbevis@graviton.com

Jeff Bevis
jbevis@graviton.com
JBevis
 
Posts: 16
Joined: Mon Jun 24, 2002 11:00 pm
Location: La Jolla, CA, USA

Re: Task gets stopped by OS_Delay()

Postby aek » Sat Jun 29, 2002 11:52 am

Hi Jeff.

Can you post the salvocfg.h you're using, and perhaps your main.c that has all the Salvo calls in it?

The OSRpt() dump looks fine -- here's why: A delay of 0 (as shown via OSRpt()) does not mean that OS_Delay() was called with a 0 argument -- if it were, the task would be stopped (and its state would be listed as stopped). It means that the task's delay is the same as the one "prior" to it, in this case, task3. I.e. task3 and task4 are both delayed for 89 ticks. One can infer this by seeing that the delayQ has two items (task3 and task4), the various pointers are OK, and task3 has a delay of 89 and task4 has a delay of 89+0, or 89 (delays are stored differentially for faster processing).

So it looks like everything is fine, but obviously you feel the task isn't running correctly. Could it be perhaps a duplicate label or something? That's why I'd like to see the whole code ...

P.S. We recommend using the CODE attributes when posting code snippets to the Forums -- you'll find info on how to use them under http://www.pumpkininc.com/ubb/ubbcode.html

Regards,

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Task gets stopped by OS_Delay()

Postby JBevis » Sun Jun 30, 2002 9:21 am

Thanks - your reply nudged me directly into discovery of my problem. It's not Salvo.

I wasn't aware that the OSRpt() output would indicate delay times in that fashion, so I incorrectly corroborated an erroneous assumption on my part :-) As it turns out, the problem was in my own code, and I was misled into believing that "stopped" task was actually not running. Suffice to say, I am back on track and all is well. Thank you again.

------------------
Jeff Bevis
jbevis@graviton.com

Jeff Bevis
jbevis@graviton.com
JBevis
 
Posts: 16
Joined: Mon Jun 24, 2002 11:00 pm
Location: La Jolla, CA, USA

Re: Task gets stopped by OS_Delay()

Postby aek » Mon Jul 01, 2002 10:16 am

Hi Jeff.

Glad to hear you solved the problem ... makes our job easier

Regards,

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 3 guests