Difference between revisions of "AS1531"

From ArmadeusWiki
Jump to: navigation, search
(Driver)
m (modprobe)
Line 53: Line 53:
 
== Use it ==
 
== Use it ==
 
=== modprobe ===
 
=== modprobe ===
To use the ADC first load module hwmon and as1531:
+
To use the ADC, first load hwmon and as1531 modules:
  
 
<pre class="apf">
 
<pre class="apf">

Revision as of 16:16, 2 May 2011

Introduction

AS1531 is a 8 channels 12bits analog do digital converter made by Austriamicrosystem. The driver is included in ARMadeus distribution and can be used with the APF51Dev board.

Soldering

AS1531 chip use a SPI bus to communicate with the microprocessor, then to use it on APFx board it must be connected to a SPI bus.

On the APF51Dev, the AS1531 is connected to the SPI1 bus by default, so you can move to next chapter.

On the APF27-Dev board it can be soldered on SPI3 bus, which is availbale on connector J8.

Soldering schema for SPI3 APF27-dev
J8 pin AS1531 pin
SD1_D0_SPI3_MISO DOUT
SD1_D3_SPI3_SS CSN
SD1_CMD_SPI3_MOSI DIN
SP1_CLK_SPI3_SCLK SCLK

Driver

Driver is by default included if you choose an APF51 as target.

Otherwise, you can select it that way:

[  ] $ make linux26-menuconfig
Device Drivers  --->
    <M> Hardware Monitoring support  --->
        <M>   Austria Microsystems AS1531 Analog to Digital Converter

Then compile the distribution :

[  ] $ make linux26 && make

Use it

modprobe

To use the ADC, first load hwmon and as1531 modules:

# modprobe hwmon
# modprobe as1531

read values

# cd /sys/bus/spi/devices/spi0.0/
# ls
driver     in1_input  in4_input  in7_input  modalias   subsystem
hwmon      in2_input  in5_input  in_max     name       uevent
in0_input  in3_input  in6_input  in_min     power

or:

# cd /sys/class/hwmon/hwmon0/device/
# ls
driver     in1_input  in4_input  in7_input  modalias   subsystem
hwmon      in2_input  in5_input  in_max     name       uevent
in0_input  in3_input  in6_input  in_min     power

To read adc value just «cat» an input :

# cat in5_input 
887

All values read are in milivolts.