The interrupt code then needs to loop through and find the actual pin that triggered the interrupt. The low power implementation uses the nrf52 sense mechanism and routes all desired pins to a single event. (I saw a recent, open issue on the Adafruit site to add low power gpio interrupts.) Using a high accuracy gpio interrupt adds 12-15uAs of power to a design. The Xiao nrf52840 and Adafruit nrf52840 implementations are using the high accuracy gpio interrupts. The nrf52840 allows both high accuracy higher power as well as low accuracy low power gpio interrupts. Someone looking to squeeze out some uAs from their design might find this useful. Xiao BLE nrf52840 (and Adafruit feature nrf52840) low power GPIO interrupts. Gpio interrupts with default interrupt impl: add 12uA to each above.gpio interrupts with modified interrupt code.Use a semaphore if you want low latency response time in your main loop. You can idle your main thread by calling delay() or by blocking the main thread with a semaphore or other similar primitive. _WFI will work as expected if you turn off RTC1.įreeRTOS will automatically put the system in system_on sleep mode and manage RTC1 if all the threads are idle. FreeRTOS is using RTC1 as a tick timer, so the calls such as _WFI keep unblocking. I think the _WFE(), _WFI, and maybe sd_app_evt_wait() are intended to run in your main loop with minimal background interrupts/events to cause the loop to wake. The Arduino code is running FreeRTOS underneath the hood, so the techniques published in the Nordic SDK don’t work as expected. (I saw an open issue to implement low power interrupts on the adafruit site.) If you use gpio interrupts, the best you can do with out of the box adafruit/seeed code is 15ua. To get the complete solution I had to rewrite the adafruit/seeed interrupt handler to use low power interrupts (code posted below). Not going to system off sleep mode, so do work sd_power_system_off() // Use this instead if using the soft device NRF_POWER->SYSTEMOFF=1 // Execution should not go beyond this Flash red to see we are going to system_off sleep mode XSemaphoreTake(xSemaphore, portMAX_DELAY) FreeRTOS will automatically put the system in system_on sleep mode here Flash green to see power on, reset, and wake from system_off PinMode(SHUTDOWN_PIN, INPUT_PULLUP_SENSE) ĪttachInterrupt(digitalPinToInterrupt(SHUTDOWN_PIN), shutdownISR, FALLING) PinMode(DO_WORK_PIN, INPUT_PULLUP_SENSE) ĪttachInterrupt(digitalPinToInterrupt(DO_WORK_PIN), doWorkISR, FALLING) (I tried to post this on the other topic, but the post is stuck in a “pending” state.) #include "Adafruit_SPIFlash.h"Īdafruit_FlashTransport_QSPI flashTransport More info on my findings below the sketch. It demonstrates system_off sleep with wake up on gpio interrupt, system_on sleep, and a low latency Arduino main loop. The arduino loop runs at 3uA (with a major caveat). Based on my digging, I developed the below sketch. I dug into the arduino core try to understand the underlying implementation. But many of the code snippets I saw in the thread were not working as I expected. I found good hints on this topic page XIAO BLE Sense in deep sleep mode.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |