I’m new to FreeRTOS though I have a lot of experience with other RTOSs.
I have a serial stream coming into a UART interrupt where the characters are stored in a large buffer. I’m trying to use a counting semaphore to count one particular character, lets call it FLAG, coming in on the UART. For each FLAG, I want to Give the semaphore to a task. In my task, I pend on a Take, then read from buffer until I get FLAG, then I pend for the next Take.
This works fine until I send a lot of messages. Eventually, my task hangs on Take. Doing this in a debugger, I can stop and look at my buffer. I can see the last Take stopped at the next to last FLAG, but I can also see the UART received more characters and another FLAG that are sitting in the buffer unread.
I tried to dig into FreeRTOS to see if I could find the actual count of the semaphore when a FLAG is in the buffer but the Take doesn’t see it, but all I can find is a void * and don’t know where the count is. I did put in a global counter on Give and Take and I find that Give is always 1 greater than Take when the hang occurs.
It appears the Give worked but the Take didn’t see it. At this point I don’t know what else to think other than this is a critical timing issue.
Anyone have any ideas on how I might find this problem?