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

Wake up from sleep in system ON mode

Hi Folks,

I am facing an issue while trying to perform a system On suspend procedure with a wake up on HITOLOW event.

No event is triggered when button pressed.

However, when I run nrf_pwr_mgmt_run() within a conditionnal loop (which exit from LP mode once port event interrupt is triggerred ), it works perfectly.

I don't understand the need for a while loop since in the first code i could check that the code is stuck in system ON mode (with No debug , just an output set to true before entering and reset once exited)

Thank you again for your explanations.

The best

Parents
  • Hi,

    If the chip wakes to check the conditional loop, it sounds like the event is at least waking the chip from System ON mode. This should be the same for both cases, however, there could be some issues with the triggering of the interrupt/event handler.

    Can you post the code snippets for the configuration of the GPIO(TE) and both the working and the non-working loop options?

    Best regards,
    Jørgen

  • Hi,

    Sorry for the slow response. I tried to reproduce the described issue with a similar code to yours:

    #include "nrf.h"
    #include "nrf_gpio.h"
    #include "nrfx_gpiote.h"
    #include "nrf_pwr_mgmt.h"
    #include "nrf_delay.h"
    
    volatile bool test = false;
    void in_pin_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
    {
        test = true;
        nrf_gpio_pin_toggle(15);
    }
    
    int main( void )
    { 
      nrf_gpio_cfg_output(13);
      nrf_gpio_cfg_output(14);
      nrf_gpio_cfg_output(15);
      nrf_gpio_pin_set(13);
      nrf_gpio_pin_set(14);
      nrf_gpio_pin_set(15);
    
    
      nrf_pwr_mgmt_init();
      uint32_t err_code;
      err_code = nrfx_gpiote_init();
      APP_ERROR_CHECK(err_code);
    
      nrfx_gpiote_in_config_t in_config = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(false); // Set low_accu to true to use PORT_EVENT.
      in_config.pull = NRF_GPIO_PIN_PULLUP; //I do have a pull up resistor on that pin
      err_code = nrfx_gpiote_in_init(11, &in_config, in_pin_handler); // in_pin_handler = IN_EVENT
      nrfx_gpiote_in_event_enable(11, true);
    
      //while(!test) {
                    nrf_gpio_pin_clear(13);
    		nrf_pwr_mgmt_run();
      //}
    
      for (;;)
      {
          nrf_gpio_pin_clear(14);
      }
    
      return 0;
    }

    I can see that both LED1 and LED2 on the DK lights up if I flash this application directly from SES, or if I run a debug session, but if I power cycle/reset the board without a debug session, I only see LED1 light up. I assume that the debug interface mode will cause some additional wakes of the chip.

    Did you run in debug mode while testing this? Can you test the attached code on your board?

    Best regards,
    Jørgen

Reply
  • Hi,

    Sorry for the slow response. I tried to reproduce the described issue with a similar code to yours:

    #include "nrf.h"
    #include "nrf_gpio.h"
    #include "nrfx_gpiote.h"
    #include "nrf_pwr_mgmt.h"
    #include "nrf_delay.h"
    
    volatile bool test = false;
    void in_pin_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
    {
        test = true;
        nrf_gpio_pin_toggle(15);
    }
    
    int main( void )
    { 
      nrf_gpio_cfg_output(13);
      nrf_gpio_cfg_output(14);
      nrf_gpio_cfg_output(15);
      nrf_gpio_pin_set(13);
      nrf_gpio_pin_set(14);
      nrf_gpio_pin_set(15);
    
    
      nrf_pwr_mgmt_init();
      uint32_t err_code;
      err_code = nrfx_gpiote_init();
      APP_ERROR_CHECK(err_code);
    
      nrfx_gpiote_in_config_t in_config = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(false); // Set low_accu to true to use PORT_EVENT.
      in_config.pull = NRF_GPIO_PIN_PULLUP; //I do have a pull up resistor on that pin
      err_code = nrfx_gpiote_in_init(11, &in_config, in_pin_handler); // in_pin_handler = IN_EVENT
      nrfx_gpiote_in_event_enable(11, true);
    
      //while(!test) {
                    nrf_gpio_pin_clear(13);
    		nrf_pwr_mgmt_run();
      //}
    
      for (;;)
      {
          nrf_gpio_pin_clear(14);
      }
    
      return 0;
    }

    I can see that both LED1 and LED2 on the DK lights up if I flash this application directly from SES, or if I run a debug session, but if I power cycle/reset the board without a debug session, I only see LED1 light up. I assume that the debug interface mode will cause some additional wakes of the chip.

    Did you run in debug mode while testing this? Can you test the attached code on your board?

    Best regards,
    Jørgen

Children
No Data
Related