Requirements

  • 60-SOM DVK, Power Supply, microUSB cable
  • PC with terminal program for accessing the console of the 60-SOM DVK
  • Lab power supply to insert voltages and multimeter to verify voltage reading

Setting up

Start by creating a fresh SD card to boot your 60-SOM DVK as described in the 60-SOM Getting Started guide

Download the latest release from the 60-SOM releases page on Github:

60 SOM Releases Page

When done, insert the freshly written SD card into your 60-SOM DVK and boot:

Terminal connected to 60-SOM

The default username is “root”, and the default password is “summit”.

Summit Linux som60sd-laird-7.648.0.13
summit login: root
Password:
#

Reading the ADC

Query the ADC capabilities of the 60-SOM DVK with the following command:

grep -H "" /sys/bus/iio/devices/*/name | grep adc

Reply:

# grep -H "" /sys/bus/iio/devices/*/name | grep adc
/sys/bus/iio/devices/iio:device0/name:f8018000.adc
/sys/bus/iio/devices/trigger0/name:f8018000.adc-dev0-external-rising
/sys/bus/iio/devices/trigger1/name:f8018000.adc-dev0-external-falling
/sys/bus/iio/devices/trigger2/name:f8018000.adc-dev0-external-any
/sys/bus/iio/devices/trigger3/name:f8018000.adc-dev0-continuous

As you can see in the reply, there is the ADC “device0”.

Change to the directory for that device and issue the ‘ls’ command:

cd /sys/bus/iio/devices/iio:device0/
# pwd
/sys/bus/iio/devices/iio:device0
# ls
buffer                   in_voltage3_raw          name
current_timestamp_clock  in_voltage4_raw          of_node
dev                      in_voltage5_raw          power
in_voltage0_raw          in_voltage6_raw          scan_elements
in_voltage10_raw         in_voltage7_raw          subsystem
in_voltage11_raw         in_voltage8_raw          trigger
in_voltage1_raw          in_voltage9_raw          uevent
in_voltage2_raw          in_voltage_scale
#

With referencing the below schematic snippet of the 60-SOM you can see that the following ADC pins are presented at J19 of the DVK:

ADC circuit of 60-SOM - schematic

First read-out

Place a jumper between pin1 and pin2 of J19. This shortens AD2 to GND and the readout should be 0:

Issue the following command:

cat in_voltage2_raw

and you will see the confirmation that the voltage is zero.

Confirmation - zero voltage cat-in-voltage2-raw

Other example readout:

Confirmation - 2491 voltage

Interpreting the reading

This reading reflects a 12bit ADC. You can verify this in the SAMA5D36 data sheet, available on the SAMAD536 product page at microchip.com.

This is expressed as a decimal in the range of [0 to 4095].

An ADC reading as above of 2491 at a reference voltage of 3.3V (ADVREF) gives us:

3.3V x 2491 / 4095 = 2.01V

Very near to the expected 2V.

Warning: Never exceed the max voltage (3.3V) allowed for the ADC pins!

If in doubt, consult the 60 Series SOM datasheet.