# Adc-Study-HardwareSoftwareInterface ## Table of Content 1. [Adc Study, hardware software interface](#adc-study-hardwaresoftwareinterface) 1. [History](#reference-order) 2. [Introduction](#introduction) 1. [Reference order](#reference-order) 3. [Hardware Software Interface](#hardware-software-interface) 1. [ADC software interface](#hardware-software-interface) 2. [ADC software configuration](#adc-software-configuration) 3. [Data acquisition loop](#data-acquisition-loop) 4. [Data acquisition loop](#data-acquisition-loop) 4. [Tests to be performed](#tests-to-be-performed) 1. [Values at max voltage](#values-at-max-voltage) 2. [Values at min voltage](#values-at-min-voltage) 3. [Valuees with a known resistor value](#values-with-a-known-resistor-value) ## History | Rev | Date | Author | Description | |-----| -------- | ------------| -----------| | 01 | 23/02/2025 | Ebersold A. | Creation, initial version| # Introduction The aim of this document is to study the delta temperature measurement between the real temperature and the Condictivity board temperature measures. ## Reference order This document is referenced as **2025-02-ET-0001-Adc-Study-HardwareSoftwareInterface.md**. It was created to answer nehemis request regarding poor temperature measurement results on Conductivity board. The delta between the real temparture and the measure value of the board is 2C°. # Hardware software interface The eletronic part is depicted below. It shows the resitor devider and the drawing Fig 1. Electronic block The TEMP pin is directly connected to pin PA0. Hence it must be configured as an analogue input. ## ADC software configuration As of today, the ADC is configured to perfom single acquisitions. Hight precision measurement is expected by the ADC. Hence it shall use the 12Bits resolution. Remarque : There is a possibility to perform a tempature compensatation on VintRef value. This requires a two value aquisition for one measurement. TODO verify if this is required or not. ## Data acquisition loop Looking at the firmware, it appears that the temperature acquisition happens after each scheduler loop. A acquisition period should be defined. Motivation: The temperature changes slowely and it's not necessary to aquire a temperature every 10ms or even lesser. ## Data conversion blocks The temperature computation goes through 3 basic blocks. 1. The raw value acquisition from the ADC 2. The conversion of the raw value into a Voltage 3. The conversion of the voltage into a resistor value 4. The conversion of the resistor into Kelvin This block uses the [Steinhard-hard method](https://www.dxmht.com/fr/article/steinhart-hart-and-ntc-thermistor-equation.html) to convert the resistor value into a temperature. 5. The conversion from Kelvin to Celsius # Tests to be performed In order to identify the root cause of the temperature measurement, I would suggest to create readable Open CAN disctionnary registers to be able to readout the ADC raw value, the computed Voltage. For each test below, compare the voltage computed by the board with the value measure with a voltmeter at TEMP. ## Values at max voltage Connect CTN_A to 3.3V or VCC and read out the raw value and the voltage. ## Values at min voltage Connect CTN_A to ground and read out the raw value and the voltage. ## Values with a known Resistor value Connect a know resistor between CTN_A and CTN_B and read out the raw value and the voltage.