Difference between revisions of "AS1531"
(→Driver) |
(→Use it) |
||
Line 58: | Line 58: | ||
== Use it == | == Use it == | ||
+ | === modprobe === | ||
+ | To use the ADC first load module hwmon and as1531 (if configured as module) : | ||
+ | |||
+ | <pre class="host"> | ||
+ | [ ] $ modprobe hwmon | ||
+ | [ ] $ modprobe as1531 | ||
+ | </pre> | ||
+ | |||
+ | If platform datas are declared under a module it must be loaded to. If platform data are declared under linux platform file, nothing to do. | ||
+ | |||
+ | === read values === | ||
+ | |||
+ | If chip is plugged on SPI3, adc input file will be found under directory : | ||
+ | |||
+ | <pre class="apf"> | ||
+ | # cd /sys/bus/spi/devices/spi2.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 | ||
+ | </pre> | ||
+ | or: | ||
+ | <pre class="apf"> | ||
+ | # 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 | ||
+ | </pre> | ||
+ | |||
+ | To read adc value just «cat» un input : | ||
+ | <pre class="apf"> | ||
+ | # cat in5_input | ||
+ | 3083 | ||
+ | </pre> | ||
+ | |||
+ | Maximum value to be read can be found |
Revision as of 08:56, 19 August 2010
Contents
Introduction
AS1531 is a 8 channels 12bits analog do digital converter made by Austriamicrosystem. The driver is included in ARMadeus distribution, but not currently on ARMadeus board.
Soldering
AS1531 chip use a SPI bus to communicate with the microprocessor, then to use it on APFx board it must be solder on a SPI bus. For example on APF27-Dev board it can be soldered on SPI3 bus, that can be found on connector J8.
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
The driver is included in ARMadeus distribution, then to use it, select it :
[ ] $ make linux26-menuconfig
Device Drivers ---> <M> Hardware Monitoring support ---> <M> Austria Microsystems AS1531 Analog to Digital Converter
And if the chip is plugged on SPI3 don't forget to select it :
Device Drivers ---> [*] SPI support ---> [*] CSPI3
Then compile the distribution :
[ ] $ make linux26;make
Linux specific module
/* TODO */
Use it
modprobe
To use the ADC first load module hwmon and as1531 (if configured as module) :
[ ] $ modprobe hwmon [ ] $ modprobe as1531
If platform datas are declared under a module it must be loaded to. If platform data are declared under linux platform file, nothing to do.
read values
If chip is plugged on SPI3, adc input file will be found under directory :
# cd /sys/bus/spi/devices/spi2.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» un input :
# cat in5_input 3083
Maximum value to be read can be found