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

saadc sample cant use with sd_power_system_off()

When I use saadc to sample battery's power,the software restart ceaselessly.I use the steps as following:

1.void saadc_init(void).

2.void saadc_callback(nrf_drv_saadc_evt_t const * p_event).read the sample value.

3.use nrf_drv_saadc_sample() in bsp_event_handler function. When button has pushed,saadc sample.

If I comment out saadc,software can go to sleep with sd_power_system_off().If do this ,device cant sample battery.

If I comment out sd_power_system_off(),software can work with saadc,but cant sleep.

So I don't know how to use saadc to sample and device can sleep not restart ceaselessly

Parents
  • FormerMember
    0 FormerMember

    sd_power_system_off() puts the chip in system OFF:   System OFF is the deepest power saving mode the system can enter. In this mode, the system’s core functionality is powered down and all ongoing tasks are terminated. 

    What you should use is the system ON mode: System ON is the default state after power-on reset. In System ON, all functional blocks such as the CPU or peripherals, can be in IDLE or RUN mode, depending on the configuration set by the software and the state of the application executing.

    To set the chip in system ON, use sd_app_evt_wait(). For how to use this function, see the BLE examples in the SDK.

  • Hi Kristin.I modify my third step above. I use a timer to measure battery's current every 2s. But in saadc_callback(),I use ble_bas_battery_level_update to send percent of battery level. The function return 0x3002. It represent BLE_ERROR_INVALID_CONN_HANDLE. When call ble_bas_battery_level_update(), it need to connected?Can you tell me how to solve this error? 

Reply Children
Related