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

SENSE triggered wake-up

Hi,

I'm developing for a 52833 using SDK_17.0.0 and S113_7.0.1.

I'm using the following code with the intention that when the RDY pin goes low, it will wake up the processor.  The RDY pin is connected to the output from a proximity sensor.  There is an external 4K7 pull-up.  If new data is available, the sensor pulls the RDY pin low.

     nrf_gpio_cfg_sense_set(RDY_PIN, NRF_GPIO_PIN_SENSE_LOW);
   APP_ERROR_CHECK(sd_power_system_off()); // This function will not return; wakeup will cause a reset).

I have confirmed that the sensor is working correctly, but the processor is not resetting.  Instead, it seems to get stuck in an indeterminate state where the current draw is ~6mA, compared to around 100nA before the RDY pin goes low.  If I pull the RDY pin low using a switch, then everything works as expected.  I thought this might mean that the RDY pin was not going low for long enough for the SENSE to work.  The sensor generates a series of pulses on the RDY line rather than a single transition.  However, the minimum pulse width is ~10ms, which should be plenty long enough.  Is there a problem if the SENSE input changes state during wakeup?

I then switched to using interrupts to detect RDY going low using the following code, and this works.  The interrupt routine gets called.

static void PrepareForSleep(void)
{
    ret_code_t err_code;
 
    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);
    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
    in_config.pull = NRF_GPIO_PIN_NOPULL;
    err_code = nrf_drv_gpiote_in_init(RDY_PIN, &in_config, in_pin_handler);
    APP_ERROR_CHECK(err_code);
    nrf_drv_gpiote_in_event_enable(RDY_PIN, true);
}

However, I have noticed that calls to NVIC_SystemReset() do not appear to work after running the above function.  If I call NVIC_SystemReset() before running the above then it works but if I call NVIC_SystemReset() either in the interrupt routine or anytime thereafter, then the processor gets stuck in the same indeterminate, high-current state described above.

So...

- Are there any timing requirements for SENSE signals when used to wake the processor?
- Is there anything specific that I need to enable/disable/clear before enabling a SENSE input, or after enabling a SENSE input but before calling sd_system_power_off() or NVIC_System_Reset()?

Thanks.

 

Related