TS-7250-V3 ADC: Difference between revisions

From embeddedTS Manuals
(Created page with "This board supports a 5 channels of 12-bit ADC using an integrated ADC in the i.MX6UL CPU. These are sampled up to 2MS/s between all enabled channels. All channels can sampl...")
 
No edit summary
Line 9: Line 9:
! ADC Header Pin
! ADC Header Pin
! Schematic Name
! Schematic Name
! IIO device
! IIO name
! IIO name
! Voltage
! Voltage
Line 15: Line 16:
| 1
| 1
| AN_CH1
| AN_CH1
| iio:device0
| voltage0
| voltage0
| 0-30VDC
| 0-30VDC
Line 21: Line 23:
| 3
| 3
| AN_CH2
| AN_CH2
| iio:device0
| voltage1
| voltage1
| 0-30VDC
| 0-30VDC
Line 27: Line 30:
| 5
| 5
| AN_CH3
| AN_CH3
| iio:device0
| voltage5
| voltage5
| 0-30VDC
| 0-30VDC
Line 33: Line 37:
| 7
| 7
| AN_CH4
| AN_CH4
| iio:device0
| voltage8
| voltage8
| 0-30VDC
| 0-30VDC
Line 39: Line 44:
| 8
| 8
| AN_CH5
| AN_CH5
| iio:device0
| voltage9
| voltage9
| 0-30VDC
| 0-30VDC

Revision as of 09:53, 8 January 2020

This board supports a 5 channels of 12-bit ADC using an integrated ADC in the i.MX6UL CPU. These are sampled up to 2MS/s between all enabled channels. All channels can sample 0-10VDC, but channels 0-3 can optionally sample 0-20mA as a current loop.

These ADCs are accessed through the IIO layer in Linux. For slow speed samples the sysfs interface can be used.

cat /sys/bus/iio/devices/iio\:device0/in_voltage{0,1,5,8,9}_raw
ADC Header Pin Schematic Name IIO device IIO name Voltage Current loop
1 AN_CH1 iio:device0 voltage0 0-30VDC 0-20mA
3 AN_CH2 iio:device0 voltage1 0-30VDC 0-20mA
5 AN_CH3 iio:device0 voltage5 0-30VDC 0-20mA
7 AN_CH4 iio:device0 voltage8 0-30VDC N/A
8 AN_CH5 iio:device0 voltage9 0-30VDC N/A

The current loops are enabled/disabled with GPIO:

gpioset 4 7=0 # AN_CH1 voltage
gpioset 4 8=0 # AN_CH2 voltage
gpioset 4 9=0 # AN_CH3 voltage

gpioset 4 7=1 # AN_CH1 current
gpioset 4 8=1 # AN_CH2 current
gpioset 4 9=1 # AN_CH3 current

The libiio library provides simple access to the IO:

#!/usr/bin/env python3

import iio

ctx = iio.Context('local:')
dev = ctx.find_device('2198000.adc')

scan_channels = ["voltage0", "voltage1", "voltage5", "voltage8", "voltage9"]
i = int(0)
for chan_name in scan_channels:
	chn = dev.find_channel(chan_name)
	raw = int(chn.attrs['raw'].value)

	# Scale 0-4095 to 0-2500(mV)
	scaled = raw * (2.5/4095)

	# Scale voltage divider on the pin
	r1 = 330
	r2 = 22
	v = scaled / (r2 / (r1 + r2))

	i += 1
	print('AN_CH{}_V={:.3f}'.format(i, v))