HI
We are mass producing products using nRF52832.
However, during production, a PCB was found to not detect low battery voltage for about 5%, so we are inquiring about it during review.
1-1) The circuit configuration is as follows.
1-2) SW configuration is as follows.
- Basic LPCOMP settings -> LPCOMP event occurs -> Switch to ADC to read battery voltage -> When below the reference voltage, LED display
- LPCOMP
static void lpcomp_event_handler(nrf_lpcomp_event_t event) { uint8_t bsp = 0; if (event == NRF_LPCOMP_EVENT_DOWN) { //voltage_falls_detected++; //voltage_falls_total++; if( getlpcomp_chceck() == 0 ) { bsp = getBsp_led_indication_stage(); if( ( bsp == BSP_INDICATE_IDLE ) || ( bsp == BSP_INDICATE_CONNECTED_OFF ) || ( bsp == BSP_INDICATE_USER_STATE_OFF ) ) { bsp_indication_set( BSP_INDICATE_USER_STATE_BAT_ON ); } } } } static void lpcomp_init(void) { uint32_t err_code; nrf_drv_lpcomp_config_t config = NRF_DRV_LPCOMP_DEFAULT_CONFIG; 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, lpcomp_event_handler); APP_ERROR_CHECK(err_code); nrf_drv_lpcomp_enable(); }
- ADC
nrf_drv_lpcomp_disable(); temp_bat = getBatVoltage(); nrf_drv_lpcomp_enable(); int32_t getBatVoltage( void ) { uint8_t i; int32_t temp_adc = 0; for( i = 0; i < BAT_VOLTAGE_CNT; i++ ) { temp_adc += BatVoltage(); } temp_adc /= ( BAT_VOLTAGE_CNT ); gBatVoltage = (int32_t)( ( (float)temp_adc / 0.166666667L * 0.6L / 1024L ) * 1000 ); return gBatVoltage; }
2-1) Review Symptoms
- LPCOMP: When it is lower than the reference voltage, check that it wakes up normally
- ADC: After LPCOMP wakes up, if the ADC is read and it is lower than the reference voltage, the LED should turn on, but the LED remains OFF
-> The strange thing is that after lowering the voltage below the low battery voltage and checking the wake-up by LPCOMP,
If the low voltage LED does not turn on by ADC, and the voltage is slightly increased by 0.1V, the low voltage is detected by ADC.