Hi,
I am using pca10040 board of nrf52 dk. I am running battery level measurement code on board but whenever I observed values on serial monitor it shows garbage values.when i observed values on nrfConnect App its shows correct values.
Hi,
I am using pca10040 board of nrf52 dk. I am running battery level measurement code on board but whenever I observed values on serial monitor it shows garbage values.when i observed values on nrfConnect App its shows correct values.
Can you show the log statement you are using to print on serial monitor? Maybe it's the data type that's causing the issue thus you are seeing garbage.
Can you show the log statement you are using to print on serial monitor? Maybe it's the data type that's causing the issue thus you are seeing garbage.
if (p_event->type == NRF_DRV_SAADC_EVT_DONE)
{
ret_code_t err_code;
err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER);
APP_ERROR_CHECK(err_code);
batt_lvl_in_milli_volts=ADC_RESULT_IN_MILLI_VOLTS(adc_result) +
DIODE_FWD_VOLT_DROP_MILLIVOLTS;
percentage_batt_lvl = battery_level_in_percent(batt_lvl_in_milli_volts);
NRF_LOG_INFO("p_event->data:::%d\r\n", p_event->data.done.p_buffer[0]);
NRF_LOG_INFO("batt_lvl_in_milli_volts:::%d\r\n", percentage_batt_lvl);
}Hi.
Which SDK are you using?
Are you using any example?
I observed values on serial monitor
What type of serial communication are you using? UART? RTT?
Could you post some more code?
Best regards,
Andreas
UART