Difference between revisions of "MCP4912"
From ArmadeusWiki
(→Connections) |
(→Driver) |
||
Line 11: | Line 11: | ||
== Driver == | == Driver == | ||
− | The driver is included in ARMadeus distribution, | + | The driver is included in ARMadeus distribution, and has to be selected (done by default on [[APF51]]): |
<pre class="host"> | <pre class="host"> | ||
Line 26: | Line 26: | ||
Then compile the distribution : | Then compile the distribution : | ||
<pre class="host"> | <pre class="host"> | ||
− | [ ] $ make linux26 | + | [ ] $ make linux26 && make |
</pre> | </pre> | ||
Revision as of 09:41, 3 May 2011
Contents
Description
This 2 channels 10bits SPI DAC (Digital to Analog Converter) is mounted in standard on the APF51Dev development boards.
Connections
On your APF51Dev there are 2 signals to use:
- DAC_OUTA: corresponds to OUTA (pin 1 of J5 on the APF51Dev). It's the first output.
- DAC_OUTB: corresponds to OUTB (pin 10 of J5 on the APF51Dev). It's the 2nd output.
The default output voltage range is 0->2.5V on the APF51Dev because the reference output of the AS1531 is used as reference for the mcp4912
Driver
The driver is included in ARMadeus distribution, and has to be selected (done by default on APF51):
[ ] $ make linux26-menuconfig
Device Drivers ---> <*> Staging drivers ---> <*> Industrial I/O support ---> <M> Microchip MCP4902, MCP4912, MCP4922 driver
Then compile the distribution :
[ ] $ make linux26 && make
Use it
modprobe
To use the DAC first load module:
# modprobe mcp49x2
set values
# cd /sys/bus/spi/devices/spi0.1/device0 # ls dac_power_mode_0 out0_raw power uevent dac_power_mode_1 out1_raw subsystem
To set the dac A value to 2.48V (max range) :
# echo 1023 > out0_raw
To set the dac B value to 1V :
# echo 412 > out1_raw