Home/Support/Support Forum/"panic: Unable to Pend on ThreadX Semaphore" shown in STDIO console
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

"panic: Unable to Pend on ThreadX Semaphore" shown in STDIO console

0 votes
When debugging my code on the Connect ME, I get the following message, and the firmware stops running.

"panic: Unable to Pend on ThreadX Semaphore, in file tfKernelPendCountSem, line number 0"

Has anyone else seen this message, and if so, how did they fix it?

I'm using a binary semaphore (tx_semaphore_get with TX_NO_WAIT/tx_semphore_put) as a simple way to lock variables. Is there another mechanism I should use? Mutexes, perhaps?
asked Sep 2, 2014 in NET+OS by cbrumley New to the Community (5 points)

Please log in or register to answer this question.

2 Answers

0 votes
 
Best answer
I had done some analysis on different crashes and the symptoms they cause. From what I saw the message you display can be caused by one of the following:

ARM7 processor:
Global buffer overflow

ARM9 processor:
stack buffer underflow
malloced buffer underflow
global buffer underflow

In most cases you have some code that is writing where it should not be writing and as a result you have trashed something vital.
answered Sep 2, 2014 by dakotas_dad Veteran of the Digi Community (694 points)
selected Sep 2, 2014 by cbrumley
After some further debugging, this seems to be happening in calls to sendto. I'll investigate some more to make sure I'm not overflowing a buffer or something.
0 votes
I had one other thought. Do you have any large buffers placed on the stack as opposed to malloced? If your stack size is small relative to variables you place on the stack, you can cause weird crashes that are hard to find. Sometimes you can get around them by changing any buffers you have from stack variables to malloced variables (I did this to myself just this morning). Remember to clear out such malloced variables before use.
answered Sep 4, 2014 by dakotas_dad Veteran of the Digi Community (694 points)
...