- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when arriving in stop_mode_power_down_hook(), PRIMASK is not set so interrupts are enabled.
because of this, it is possible that there have been ISRs that have executed without their pending actions (threads that are pending on a message queue, semaphore, etc) occurring.
example flow of events:
1.
all threads sleeping
call idle function
idle function calls stop_mode_power_down_hook()
stop_mode_power_down_hook() determines device can sleep
GPIO iSR is called
ISR pushes a message to a worker thread
ISR exits
stop_mode_power_down_hook() continues & device enters deep sleep
deep sleep continues until another GPIO ISR or RTC alarm
device wakes, and performs context switch
ISR message is finally received by worker thread and processed.
example fix (which i could not implement because threadx glue code is closed):
1. determine no threads should be run
2. disables interrupts
3. check that all threads are still asleep. if there is work to do, enable interrupts and continue working.
4. call idle function
5. call stop_mode_power_down_hook and so on.
this method ensures that interrupts are disabled and any outstanding work is done before entering deep sleep. anything that occurs on the GPIO IRQ will bring the device immediately out of deep sleep.
- Tags:
- teaser
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Have you tried this with FreeRTOS or is this something that pertains to ThreadX RTOS only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
only tried this with threadx. it is an issue in the design of the stop mode function, so generally it should also occur this way in other RTOS, depending on how the adjustment of internal time is done.