How to access the ADC on armStoneA8?

  • This topic is related to all boards of the Multi-Platform Linux release. Therefore I have moved it from the armStoneA8 forum to the general Linux and Applications forum.


    Support for a generic ADC device was missing from the kernel in V2.0. We will add this feature to V2.1. It will use the hwmon infrastructure to read ADC channels via sysfs. This is OK if you want to read a value rather infrequent, e.g. to check some battery voltage or similar. It is not well suited if you want to read ADC values at a high frequency. Then you'll need your own device driver that attaches to the generic ADC driver.


    All of you who can't wait and want to have an immediate solution can apply the rather large patch attached to this post to add this hwmon feature to V2.0.


    With this patch you'll have a path

    Code
    1. /sys/class/hwmon/hwmon0/device


    that shows some devices adcx_raw, where x is the channel number. For example you can read the current ADC value of channel 6 with the following command:

    Code
    1. cat /sys/class/hwmon/hwmon0/device/adc6_raw


    The following list shows the mapping from pin numbers to channel numbers


    • Channels 2 to 5 are the channels also used for touchpanel: channel 2: YM, channel 3: YP, channel 4: XM, channel 5: XP. So these channels are available on the touch connector and can only be used as normal ADC channels if the analog resistive touch is not in use. They are available on all boards.
    • armStoneA8 has also channels 6 to 9 on pins 29/31/33/35 of the feature connector.
    • NetDCU14 has also channels 6 and 7 on pins 11 and 12 of connector J7 (optionally also channels 8 and 9 on pins 9 and 10 if the hardware is configured to use two additional analog inputs instead of ttySAC2)
    • PicoMOD7A does not support any other channels, only channels 2 to 5.


    Your F&S Support Team