Other Parts Discussed in Thread: Z-STACK
Hi,
We are using Z-Stack v.2.5.1 (or 2.6.0.3) in a very low power sensor.
I am trying to start an event from a hardware interrupt service. The system uses POWER_SAVING and can be in sleep state tens of seconds. A HW interrupt wakes up the system, and its ISR is executed ok. The problem is, that I have one task (initialised etc.) and I would like to set an event to the task inside the ISR, that would get executed after a small time or immediately after exiting the ISR. I can not make this work; the set event in the ISR is served only after one next previously and potentially unrelated timed event is served. I.e. it looks like the system goes to sleep mode after the ISR, and wakes up only to the previously set timed task, not to the one set in the ISR.
In other words; there are several timed events handled in multiple tasks. If I try to use in the ISR e.g. osal_set_event(MyTaskID,MYEVENT) or a timed event osal_start_timerEx( MyTaskID, MYEVENT,100), then the MYEVENT in the MyTaskID gets processed only after some other, previously set timed event executes, which may happen after a long time. So, it looks like the system goes to sleep after ISR exit, and the updated list of expiring tasks does not get actually processed until the previously set another event is executed first.
There is only a couple of workarounds that I have figured: If I set a dummy MY_DUMMY_EVENT in MyTaskID, that is periodically executed for examply once a second, then the event set in the ISR gets executed once the MY_DUMMY_EVENT is executed next time. Also if the MyTaskID is set to PWRMGR_HOLD state with osal_pwrmgr_task_state() makes the event set in the ISR to be processed immediately. However both solutions are really bad as they require excess power. In fact it voids the benefits of using the HW ISR, since effectively it would be the same to use polling instead of interrupt...
Is there a neat and simple solution to this?
Thanks,
Ilkka