This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Disabling/enabling peripherals at runtime on nrf91

Are there any examples for disabling/enabling peripherals at runtime for low power purposes on the nRF91 on ncs v1.0.0?

I've seen these threads but they didn't have the info I wanted

https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/hardware-design/posts/measuring-psm-idle-current-on-the-nrf91-dk

https://devzone.nordicsemi.com/f/nordic-q-a/43728/nrf9160-low-power-example/189878#189878

I wish to disable I2C and UART before going to sleep with just the RTC enabled and wakeup after a timeout or interrupt on a single pin and enable those peripherals again

Parents
  • The following two lines shoud do it

    disable_i2c();
    NRF_UARTE0_NS->ENABLE = 0;

    You can change NRF_UARTE0_NS to whichever UART device you want to disable.

  • Sorry about the delay, I have only got around to testing this now. I have tested disabling the UART and I2C successfully but I have three more questions.

    • With an interrupt enabled on one pin I am seeing an increase of 45uA, is there a way to decrease this? The pin is configured with the following settings: GPIO_INT | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH | GPIO_INT_DOUBLE_EDGE | GPIO_INT_DEBOUNCE
    • Is there a common place where I can reenable my peripherals when leaving k_cpu_idle? I either leave idle from an interrupt or from a k_timer. I am not calling k_cpu_idle myself in any of my loops, just when all of my threads and inactive it is called.
    • I didn't find a function called disable_i2c() anywhere, where is it defined? I got around it by setting NRF_TWIM0_NS->ENABLE = 0
Reply
  • Sorry about the delay, I have only got around to testing this now. I have tested disabling the UART and I2C successfully but I have three more questions.

    • With an interrupt enabled on one pin I am seeing an increase of 45uA, is there a way to decrease this? The pin is configured with the following settings: GPIO_INT | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH | GPIO_INT_DOUBLE_EDGE | GPIO_INT_DEBOUNCE
    • Is there a common place where I can reenable my peripherals when leaving k_cpu_idle? I either leave idle from an interrupt or from a k_timer. I am not calling k_cpu_idle myself in any of my loops, just when all of my threads and inactive it is called.
    • I didn't find a function called disable_i2c() anywhere, where is it defined? I got around it by setting NRF_TWIM0_NS->ENABLE = 0
Children
Related