embOS 3.82b, IAR 5.40, ARM7: losing an event

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • embOS 3.82b, IAR 5.40, ARM7: losing an event

    I have an application running on an AT91SAM7S256 with 8 tasks. Normally the CPU utilization is very low, more than 95% idle. The highest priority task is implemented as an infinite loop, which waits for an OS_Event coming from the ISR for a timer tick. The event is signaled with a call to OS_EVENT_Pulse(). After the task sees the event it does some processing and then restarts the timer. If I do something to flood the system with work I can bring a couple of tasks up to 30% utiltization, and within seconds my hi pri task stops running. I put counters in to see how many times the event is signaled and how many times the wait succeeded in waking the task. The number of times signaled is one greater than the number of times that the tasks awakened. Since there are no other users of this event, and only one place in the code where the task waits on it, it looks like the event has been lost.
    My quick and satisfactory fix for this is to just use a task event with OS_SignalEvent and OS_WaitSingleEvent. My counters remain equal so I know with this implementation that the task is waking up once for every time that it is signaled. I hesitate to call the problem with the other mechanism a bug since my application is still pretty green. However, I use OS events and OS_EVENT_Pulse elsewhere, and am wondering if there is something that I have missed about how they work.
  • Is it possible that the missed event occurs when the task isn't actually waiting yet? If nothing is actually waiting on the event when OS_EVENT_Pulse() gets called, the event will never be 'seen'.

    If the task is the only thing that will ever wait for the event, it might be better to simply use OS_EVENT_Set() rather than OS_EVENT_pulse() so the task waiting for the event will see it regardless if the event is set while it's waiting or not. Or use a OS_CSEMA counting semaphore if the task needs to account for each event.