I am getting odd samples from TSC_ADC, definitely I am missing something. Can you help me to figure out what I am missing, please?
I am using a beagle bone black industrial by element14, debian 8.6, code composer studio v7, and this header. Sampling is done in this code, which send data to an ARM task counterpart which displays values on stdout.
The aim is to understand how to sample via TSC_ADC.
Currently, I am sampling a channel (i.e. inp = AIN6 = 1.6V, double checked with multimeter and oscilloscope) via TSC_ADC. This channel is sampled in single-ended mode and in differential mode (i.e. inm = AIN0 = GND ADC ).
In order to do that, I am using 2 steps of TSC_ADC (i.e. from STEP1 and STEP2): the first step has differential mode enabled (i.e. STEP1 ), while the other step has single-ended mode enabled (i.e. STEP2). All steps averaging is set to 4 (i.e. 16 samples).
The resulting samples expressed as decimals are about:
- 1600 from STEP1;
- 1950 from STEP2.
These samples should be converted as 1.6V, but they do not by using official “formula”. For example, 1.6 / 4095 * 1.8 = 3640.
What I am doing wrong? : \
In order to enable the sampling, the following setps are done in such order in this code: CTRL register is set to 6, STEP1 & STEP2 Averaging is set to 4, STEP 1 Diff_CNTRL is set to 1, STEP1 & STEP2 SEL_INP_SWC_3_0 is set to 6, STEP1 SEL_INM_SWC_3_0 is set to 0, STEPENABLE register is set to 6, and CTRL register is set to 7.