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

Advertise then sd_power_system_off

Looking for an example on how to advertise for 10 seconds then go into sd_power_system_off. Trying this by using ble_app_template (s112, ses, sdk15.0, custom, 1 led, 1 rgb, no sensor, no button).

After setting APP_ADV_DURATION = 1000, flash with NRF_LOG_ENABLED = 0, and then reconnect from DK to external 3.3v source, the LED continues to flash and advertise after 10s.

What other step needed to get into BLE_ADV_EVT_IDLE then sleep_mode_enter then sd_power_system_off for no LED and no advertise ?

-thank-you.

Parents
  • Hi,

    It should be sufficient to change the advertisement timeout like you did. Maybe there is an IO that triggers wake-up immediately after entering system OFF. Suggests to check your pin configurations to see if there are any with the sense mechanism enabled. 

            /*Pins that are not needed in system OFF should be configured to reset state
              to avoid leakage currents and unexpected wakeups.*/
            nrf_gpio_cfg_default(PIN_x);
            nrf_gpio_cfg_default(PIN_y);
            ...
            
            /* Configure wakeup pin (optional)*/
            nrf_gpio_cfg_sense_input(WAKE_UP_PIN,
                                     NRF_GPIO_PIN_NOPULL, // Apply pull if input can become floating
                                     NRF_GPIO_PIN_SENSE_HIGH or NRF_GPIO_PIN_SENSE_LOW);

Reply
  • Hi,

    It should be sufficient to change the advertisement timeout like you did. Maybe there is an IO that triggers wake-up immediately after entering system OFF. Suggests to check your pin configurations to see if there are any with the sense mechanism enabled. 

            /*Pins that are not needed in system OFF should be configured to reset state
              to avoid leakage currents and unexpected wakeups.*/
            nrf_gpio_cfg_default(PIN_x);
            nrf_gpio_cfg_default(PIN_y);
            ...
            
            /* Configure wakeup pin (optional)*/
            nrf_gpio_cfg_sense_input(WAKE_UP_PIN,
                                     NRF_GPIO_PIN_NOPULL, // Apply pull if input can become floating
                                     NRF_GPIO_PIN_SENSE_HIGH or NRF_GPIO_PIN_SENSE_LOW);

Children
  • In sleep_mode_enter() I added the default for the unused pins and NOSENSE to disable the sense mechanism as suggested (and from a previous case, the lines seemed to go just before sd_power_system_off()), sample line:

    nrf_gpio_cfg_default(0);
    nrf_gpio_cfg_sense_set(0, NRF_GPIO_PIN_NOSENSE);

    ....that did not seem to help, advertising continued.

    From this case it seemed to suggest that pins should be set to input and that the internal switch be set to disconnect.

    Using sample  NRF_LOG_INFO("PIN_CNF0: %08X\n", NRF_GPIO->PIN_CNF[0]); unused pins all came up as 0000000002 (input, sense high) except for P0.06 as 00000003 (input, sense low) even after setting NOSENSE (6.8.2.10 in product spec).

    So now not sure  why pins are not setting to NOSENSE and how to disconnect internal switches by code like NRF_GPIO->PIN_CNF[] or nrfjprog (unless its nrf_gpio_input_disconnect(0); which was also tested)

    -thank-you.

  • It seems like it might be unrelated to the IO configurations. 0x00000002 is actually the reset state (input, disconnect), and 0x00000003 means that they pin is configured as an output (TX line for UART), see register description here for details.  

    Please try attached example and see if you see the same problem. I took the template example from SDK 15 and commented out the button/leds initialization, changed the adv. timeout to 10 seconds, and configured added an output pin for indicating wakeup and sleep state (WAKEUP_IND).

    ble_app_template_enter_system_off.zip

  • I had not commented out the wakeup buttons and now total system off with button set for reset.

    -thank-you.

Related