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

No wake up after LPCOMP set in SYSTEM OFF nrf52 SDK12.1

Hi,

Im trying to wake up from SYSTEM OFF using LPCOMP.

Im using the following code to power off:

nrf_drv_lpcomp_config_t config = NRF_DRV_LPCONF_DEFAULT_CONFIG;
config.hal.detection=1;
config.hal.reference=1;
config.input = NRF_LPCOMP_INPUT_2;
// initialize LPCOMP driver, from this point LPCOMP will be active and provided
// event handler will be executed when defined action is detected
err_code = nrf_drv_lpcomp_init(&config, wakeUp);
APP_ERROR_CHECK(err_code);
nrf_drv_lpcomp_enable();
sd_power_system_off();

For some reason there is no wake up triggered. Debugger is disconnected.

I know the pin is correct and LPCOMP works in active mode because I use LPCOMP to detect going under voltage to initiate powering off.

Thanks!

Parents
  • Hi,

    Before going to System OFF mode, you will need to wait for the LPCOMP to be ready. In the product specification its stated that:

    After a start-up time of t_LPCOMP,STARTUP the LPCOMP will generate a READY event to indicate
    that the comparator is ready to use and the output of the LPCOMP is correct
    

    So change your code to:

    nrf_drv_lpcomp_config_t config = NRF_DRV_LPCONF_DEFAULT_CONFIG;
    config.hal.detection=1;
    config.hal.reference=1;
    config.input = NRF_LPCOMP_INPUT_2;
    // initialize LPCOMP driver, from this point LPCOMP will be active and provided
    // event handler will be executed when defined action is detected
    err_code = nrf_drv_lpcomp_init(&config, wakeUp);
    APP_ERROR_CHECK(err_code);
    nrf_drv_lpcomp_enable();
    while(NRF_LPCOMP->EVENTS_READY == 0);
    NRF_LPCOMP->EVENTS_READY = 0;
    sd_power_system_off();
    
  • Thanks very much Sigurd, that was the problem indeed!

Reply Children
No Data
Related