Hello everyone,
We are using the nrf52840 Dev Kit (PCA10056 1.1.0 2019.19 683465548)
SDK Version: 15.3
OS: Fedora
When we are generating a 1V voltage our adc returns values between [260, 280]. We use this function to convert it into µV:
Fullscreen
1
2
3
4
5
6
7
8
#define ADC_REF_VOLTAGE_IN_MILLIVOLTS 600
#define ADC_RES_10BIT 1024
#define ADC_PRE_SCALING_COMPENSATION 6
int32_t adc_result_to_uv(int16_t adc_value) {
int32_t adc_uv = ((((adc_value) * 600000) / 1024) * 6);
return adc_uv;
}
We tried to change the resolution into 14 BIT like above:
Fullscreen
1
2
3
4
5
6
7
8
#define ADC_REF_VOLTAGE_IN_MILLIVOLTS 600
#define ADC_RES_14BIT 16384
#define ADC_PRE_SCALING_COMPENSATION 6
int32_t adc_result_to_uv(int16_t adc_value) {
int32_t adc_uv = ((((adc_value) * 600000) / 16384) * 6);
return (int32_t) adc_uv;
}
But we get strange results:
- adc_value between [4200, 4400]
- adc_uv around -631554 µV
We don't know what we are doing wrong and how to get a better precision...
Any ideas?