This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62P: Binary Semaphore post/pend issue

Part Number: AM62P

Hello,

I'm having a problem related to semaphore post/pend operations in my app running on the M4 core of AM62x platform. I have a task that blocks waiting on a SemaphoreP_pend(). The task priority is high (configMAX_PRIORITIES - 2). When the semaphore is posted, this task wakes up and does some processing that takes about 1ms, measured with xTaskGetTickCount(), then goes to wait on the semaphore again. The semaphore is posted in a function called from ISR context. The semaphore is posted every 4ms. I added some trace around the post and pend calls to confirm the timing.

        log_trace_entry(&dbg_trace_buffer, 3);               // Event # 3
        SemaphoreP_pend(pads131a04Semaphore);
        log_trace_entry(&dbg_trace_buffer, 2);

        log_trace_entry(&dbg_trace_buffer, 0);
        SemaphoreP_post(pads131a04Semaphore);
        log_trace_entry(&dbg_trace_buffer, 1);
 
When things are running clean, I get the correct sequence of events 3->0->1->2. However, after running for sometime (anywhere from an hour to 10+ hours), we get into a situation where the semaphore gets posted at expected time but the task waiting doesn't wake up until after two more post operations. To me, that seems like a scheduling issue but wanted to get your thoughts and if you have suggestions on how to zoom in on the root cause. Here is a trace I captured (a tick is 0.1ms).
 

Tick     Event

==== ==
15948928 3                     Task waiting on sem
15948964 0                     ISR callback about to post the semaphore
15948964 1                     ISR posted the semaphore
15948964 2                     Task woke up and started processing

.......

15948971 3                     Task waiting on sem 
15949007 0
15949007 1
15949050 0
15949050 1
15949092 0
15949092 1
15949099 2                    Task finally woke up
15949135 0
15949135 1
15949178 0
15949178 1

Thanks

-Ayman