AnsweredAssumed Answered

lwevents not working as documented ?

Question asked by George Pontis on Jun 12, 2015
Latest reply on Jun 30, 2015 by George Pontis

Re: MQX 4.2 on K64


I am having quite a bit of trouble with lwevents. The event is created with the auto_clear option. An ISR sets an event at the end of a DMA scan of ADC channels. Two or more tasks wait for the event. The event is generated periodically, about every 17ms. I verified this by toggling an IO pin in the ISR.


Two tasks, with different priorities, contain nothing but a while loop that waits on the same event. I am expecting that both will briefly go active each time the event is set. In fact what happens is that each task gets half the events. This is contrary to the documentation, and not nearly as useful a mechanism.


I also see that the lwevent unblocks immediately and without a fresh event, if there were previous events set when no task was waiting on them. I don't think that this is proper if the event group was created with the LWEVENT_AUTO_CLEAR option. This might be avoided by calling lwevent_clear in the ISR immediately after calling lwevent_set. At least it seems to fix this so far as I can see in 1 minute of testing.


I am going to try the "heavy" events in MQX and I hope that they work better.