Adc Guide
Adc Guide
In this article we will be learning how to use ADC in AM335x based Phyboard-Wega
board, the reference has been taen fro! "I#s wii AM335x ADC Driver's Guide$
An analog-to-digital con%erter &abbre%iated ADC' is a de%ice that uses sa!(ling to
con%ert a continuous )uantity to a discrete ti!e re(resentation in digital for!$
"he "*C+ADC+** &"ouchscreen+ADC+subsyste!' is an , channel general (ur(ose
ADC, with o(tional su((ort for interlea%ing "ouch *creen con%ersions$ "he
"*C+ADC+** can be used and configured in one of the following a((lication
o(tions-
, general (ur(ose ADC channels
. wire "*, with . general (ur(ose ADC channels
5 wire "*, with 3 general (ur(ose ADC channels
, wire "*
ADC used is /0 bit *A1 ADC with a sa!(le rate of 022 3*P* &3ilo *a!(les Per
*econd'$ "he ADC sa!(les the analog signal when 4start of con%ersion4 signal is
high and continues sa!(ling / cloc cycle after the falling edge$ It ca(tures the signal
at the end of sa!(ling (eriod and starts con%ersion$ It uses /0 cloc cycles to digiti5e
the sa!(led in(ut6 then an 4end of con%ersion4 signal is enabled high indicating that
the digital data ADC78"9//-2: is ready for *W to consu!e$ A new con%ersion
cycle can be initiated after the (re%ious data is read$ Please note that the ADC out(ut
is (ositi%e binary weighted data$
Hardware Setup:
;or ADC channels on board refer <section = >x(ansion connector? fro! hardware
!anual of (hy@7A1D-Wega fro! below lin$
ft(-AAft($(hytec$deA(ubAProductsAIndiaA(hy@7A1D-W>BA-AM335xACinuxADocADA1DWA1>-MAE8AC-W>BA$(df
Driver e!e"tio#:
>nable the following o(tions in the linux ernel as follows$
Device Drivers --->
[*] Staging drivers --->
[*] Industrial I/O support --->
[*] Enable buffer support within IIO
*> Industrial I/O loc! free software ring
> Industrial I/O buffering based on !fifo
-*- Enable triggered sa"pling support
#$% &a'i"u" nu"ber of consu"ers per trigger
(nalog to digital converters --->
*> )I*s (D+ driver
Also enable the <"ouch *creen AADC chi(s? su((ort$
Device Drivers --->
Multifunction device drivers -->
<*> TI ADC / Touch Screen chip support
Addi#g P!at$or% data:
ADC (latfor! data is added in board file&archAar!A!ach-o!a(0Aboard-(c!25/$c' as
shown below$
,include linu'/platfor"-data/ti-adc.h>
static struct adc-data a"//0'-adc-data 1 2
.adc-channels 1 34
56
static struct "fd-tscadc-board tscadc 1 2
.tsc-init 1 7a"//0'-touchscreen-data4
.adc-init 1 7a"//0'-adc-data4
56
"he (ara!eter 4adc+channels4 needs to hold data related to how !any channels you
want to use for ADC$
If ADC and touchscreen are used together, add (latfor! data as shown abo%e$
If ADC alone is being used, you will need to re!o%e (latfor! data for touch
screen$