ADC Values ofsett.

Hello,

We have a sensor with 2 ADCs inputs meauring identical LMT70s on the board. With one of our older firmwares we get the accurate valudes of 22deg or so on both channels. But in intergrating nusim the tempratures seems to have ofssets of 5-10 degree just with a firmware change, and it gets reversed when the older fimware is installed. Is there something in the config or overlay that could cause this issue?

Fullscreen
1
2
3
4
5
6
7
8
adcSetup();
uint16_t pipeTemp = 0;
uint16_t airTemp = 0;
while(1){
measureADC(&pipeTemp, &airTemp);
printf("%04d:%04d\n", pipeTemp, airTemp);
k_msleep(100);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

2478:3053
2489:3070
2483:3076
2483:3065
2483:3076
2489:3070
2483:3065
2483:3065
2483:3070
2466:3059
2466:3053

The rest of the code that calls these functions is below. I get much closer values with the code without the software sim. 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* @brief This function configures two ADC channels (ADC0 and ADC1) for reading temperature values.
*
* It sets up specific configurations for both channels, such as gain, reference voltage,
* acquisition time, channel_id, positive input, and differential mode. It's worth noting
* that the ADC_REF_INTERNAL (0.6V) and ADC_GAIN_1_2 (0.5x input multiplier) are used to
* set a measurement range of 0-1.2V.
*
* Before setting up the channels, the function checks if the ADC device is ready, returning
* an error if it is not. It also triggers an offset calibration task on the SAADC.
*
* The ADC channels are set up using the `adc_channel_setup` function. If an error occurs
* during this process, the function will print an error message and return the error code.
*
* @return: The function returns 0 if both ADC channels are successfully set up. If the ADC
* device is not ready or if an error occurs while setting up an ADC channel, it will return
* a negative error code.
*/
int adcSetup() {
// ADC0 Pipe ADC Channel
struct adc_channel_cfg adc0 = {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Regards,

Sawaiz