TS-7250-V2 ADC

From embeddedTS Manuals

The TS-7250-V2's on-board ADC supports five channels of analog data input, for example:

root@ts7250-f7144f:~# tshwctl --adc
baseboard_model=0x0
baseboard=8200
baseboard_rev=A
adc4=0
adc3=0
adc2=0
adc1=0
adc0=5096

This output demonstrates 5.096 volts applied to ADC channel 0 (A/D header, pin 1). The tshwctl utility's output is in millivolt resolution. The ADC hardware contains voltage dividers to anticipate 0 V to 30 V input, At 16 bit resolution, the output of this hardware is rendered in millivolts. Should the ADC hardware need to be accessed directly, an example of how this is done via C is found in the tshwctl.c source code.

ADC channels 0, 1, and 2 can be switched to 4-20 mA current sensing analog inputs. This is done by setting MFP_73, 74, or 75 respectively (these are CPU IO pins).

This is how to test current-loop sensing from the command line:

#turn on gpio & output mode for control pins:
#gpio mode mfp_73,74,75
devmem 0xD401E124 32 0x800
devmem 0xD401E128 32 0x800
devmem 0xD401E12C 32 0x800
#direction output
devmem 0xd4019014 32 0x0e00
#turn on current sense. 
devmem 0xd4019020 32 0x0e00
#read adc now in current sense mode on ch. 0-2  
tshwctl --adc

Since the ADC is now reading 0-30V across a voltage divider, the output requires some mathematical interpretation. Take the value reported by the ADC and divide it by the sum of the series resistance. This is normally just 240 ohms. That will render the output value in milliamps.