A ready to use binary version of the A/D converter Linux driver is available on this site. You can download it directly on your Acme board by typing:
Load the driver module inside the kernel by typing:
debarm:~# insmod at91-adc.ko Major: 250; minor: 0 Registered device at91_adc.
now move in /sys/bus/platform/devices/at91_adc/ and read the sample from A/D channel 0 by typing:
debarm:~# cd /sys/bus/platform/devices/at91-adc/ debarm:~# cat chan0 512
Turn the trimmer and read the value again.
This simple Python code continuously reads the samples from all the four A/D channel and shown the voltage read.
debarm:~/playground/python/adc# python read.py Channel 0 = 2.32 volt Channel 1 = 1.69 volt Channel 2 = 1.64 volt Channel 3 = 1.57 volt -------
This is the same example written in C instead of Python:
debarm:~/playground/c/adc# gcc read.c -o read debarm:~/playground/c/adc# ./read Channel 0 = 2.31 Channel 1 = 1.70 Channel 2 = 1.64 Channel 3 = 1.57 -------
The at91-adc driver source is available on this GitHub repository: https://github.com/tanzilli/at91-adc
To compile the driver from sources you need install the Linux Kernel tree on your Linux PC and the toolchain requested to compile it for ARM architecture.
Compile it and copy the module of your Acme board by typing:
$ git clone git://github.com/tanzilli/at91-adc.git $ cd at91_adc $ make $ scp at91_adc.ko root@[ip address of your acmeboard]:/root
Many thanks to Claudio Mignanti, Stefano Barbato, Antonio Galea, Mark Richards, Douglas Gilbert for their contributions.