[En-Nut-Discussion] Courious problem with NutEventWait()

Ulrich Prinz uprinz2 at netscape.net
Mon Apr 4 21:51:24 CEST 2011


Hi!

I have a small problem with the eNut Event system.

I installed a handle
HANDLE van_evt;

I Post this event in the init part of a thread and then wait and timeout
on that event via

THREAD(...)
{
Init();
NutEventPost( &van_evt);

while (1)
{
NutEventWait( &van_evt, 1000)
DoSomething();
}
}

This so far works.

Now I added an external interrupt:
void Exti2( void *arg)
{
NutEventPostFromIrq(&van_evt);
ClearIrq(thisIrq);
}

And at the moment the IRQ rises, the system lives some milliseconds and
then runs into UsageFault trap.

Ok, I thought I never checked external interrupts so they might not
work. I modified the irq to just toggle a GPIO and that works.
So I added a simple thing to the main loop:

main()
{
Init();
blabla();
...
while (1)
{
NutSleep(100);
NutEventPost(&van_evt);
}
}

This should now wake up the Event ten times faster then its timeout.
But, the system crashes... UsageFault Trap.

Now I checked my sources and found, that I use events in many other
places with success. I.e. the LED handler and I2C, both use events for
coordination. So why does this event crash my system?

For thos who never saw a UsageFault Trap, it's a 'feature' of Cortex
architecture and yes, this code runs on STM32F103. But it must be a more
general thing that breaks up the system.

Any suggestions?

Thanks in advance
Ulrich






More information about the En-Nut-Discussion mailing list