Hello all,
I have a thread which stays in wait state, until an event is fired. So, in this thread I use
eventmask_t e = chEvtWaitOne(3);
which should stand for: wait for eventmask 1 or 2... is this right?
In interrupt routine, I fire events through:
chEvtSignalFlags(thread_in_wait, 1);
or
chEvtSignalFlags(thread_in_wait, 2);
Problem is I always receive 1. Is it possible to decode the originated event?
Thanks
-g
How to find originated event
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: How to find originated event
Hi,
The only error I see is that you should use chEvtSignalFlagsI() from an ISR, doesn't the state checker complain about that?
The function chEvtWaitOne(3) should return you 1 or 2 depending on the signaled flags, are you sure that signaling 2 is really executed?
Giovanni
The only error I see is that you should use chEvtSignalFlagsI() from an ISR, doesn't the state checker complain about that?
The function chEvtWaitOne(3) should return you 1 or 2 depending on the signaled flags, are you sure that signaling 2 is really executed?
Giovanni
Re: How to find originated event
Well, I did as you wrote and now I get both of the events simultaneously.
I set the thread priority to HIGH level, but I still get both of the events at the same time.
Is the interrupt routine signaling events too fast?
I set the thread priority to HIGH level, but I still get both of the events at the same time.
Is the interrupt routine signaling events too fast?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: How to find originated event
chEvtWaitOne() should only return an event each time, a single bit at 1 in the returned mask (and it is not matter of speed). chEvtWaitAny() would return all the pending bits at once.
It is very strange chEvtWaitOne() returning 3, are you sure?
Giovanni
It is very strange chEvtWaitOne() returning 3, are you sure?
Giovanni
Re: How to find originated event
Ok, I solved it by removing a chevtclearflags I tried before.
just for information: where could I find more info about "state checker"?
-g
just for information: where could I find more info about "state checker"?
-g
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: How to find originated event
Hi,
It is one of the debug options found in chconf.h, it verifies that the various APIs are called from the right context, for example S-class and I-class APIs called from within a lock.
It is mentioned in this article: http://www.chibios.org/dokuwiki/doku.ph ... ebug_guide
Giovanni
It is one of the debug options found in chconf.h, it verifies that the various APIs are called from the right context, for example S-class and I-class APIs called from within a lock.
It is mentioned in this article: http://www.chibios.org/dokuwiki/doku.ph ... ebug_guide
Giovanni