Using the SAMA5D2-compatible ADC device
Introduction
This page describes how to test the features of the SAMA5D2-compatible ADC device. This driver uses the Industrial Input/Output (IIO) subsystem.
Documentation for the IIO subsystem is available in the kernel source code directory: drivers/staging/iio/Documentation
and Documentation/iio
.
Kernel
The driver (features are added little by little) for the SAMA5D2-compatible ADC device is available on:
- linux-4.1-at91

- linux-4.4-at91

- Mainline kernel from version 4.6
The ADC drivers is automatically selected if you use sama5_defconfig. Otherwise, check you have set CONFIG_AT91_SAMA5D2_ADC.
To check that ADC driver is correclty loaded:
# dmesg|grep at91-sama5d2_adc
at91-sama5d2_adc fc030000.adc: version: 800
# ls /sys/bus/iio/devices/iio\:device0
dev in_voltage2_raw in_voltage8_raw
in_voltage-voltage_scale in_voltage3_raw in_voltage9_raw
in_voltage0-voltage1_raw in_voltage4-voltage5_raw in_voltage_scale
in_voltage0_raw in_voltage4_raw name
in_voltage10-voltage11_raw in_voltage5_raw of_node
in_voltage10_raw in_voltage6-voltage7_raw power
in_voltage11_raw in_voltage6_raw sampling_frequency
in_voltage1_raw in_voltage7_raw subsystem
in_voltage2-voltage3_raw in_voltage8-voltage9_raw uevent
Tips: The ADC controller doesn't manage its pins in the same way as other ones. PIOs can't be assigned to it. It will automatically use them (if not assigned to another peripheral) when enabling the corresponding channel. To reserve PIOs for the ADC, you could declare them as GPIO in the device tree. By doing this, if there is a conflict with another peripheral, you'll be warned. You should also disable pull-up and pull-down to have coherent measurement when the PIO is not used by the ADC device. Here is an exemple from at91-sama5d2_xplained.dts for AD4 signal:
pinctrl_adc_default: adc_default {
pinmux = <PIN_PD23__GPIO>;
bias-disable;
};
Software triggers
Unsigned single-ended channel conversion
Setup
- Connect a waveform or DC generator to the pin 4 of J8 connector called A3. You can also use a resistor bridge as the image below shows

Test procedure
- request the conversion:
# cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw
3693
- request the scale:
# cat /sys/bus/iio/devices/iio\:device0/in_voltage_scale
0.805664062
- check the conversion by multiplying the conversion value with the scale:
3693 x 0.8 = 2954.4 mV
Signed differential channel conversion
Setup
Use A3 (AD4) and A6 (AD5) from J8 connector
Test procedure
- request the conversion:
# cat /sys/bus/iio/devices/iio\:device0/ in_voltage4-voltage5_raw
-396
- request the scale:
# cat /sys/bus/iio/devices/iio\:device0/in_voltage-voltage_scale
1.611328125
- check the conversion by multiplying the conversion value with the scale:
-396 x 1.6 = -633,6 mV
- you can compare it manually with the help of single ended conversions:
# cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw
1237
# cat /sys/bus/iio/devices/iio\:device0/in_voltage5_raw
2031
# cat /sys/bus/iio/devices/iio\:device0/in_voltage_scale
0.805664062
(1237-2031) x 0.8 = -635.2 mV
Using the SAMA5D2-compatible ADC device的更多相关文章
- mini2440驱动奇谭——ADC驱动与測试(动态挂载驱动)
博客:http://blog.csdn.net/muyang_ren 实现功能:开发板动态载入adc驱动模块并能通过測试程序 系统:Ubuntu 14.04 驱动交叉编译内核:linux-2. ...
- linux 混杂设备驱动之adc驱动
linux2.6.30.4中,系统已经自带有了ADC通用驱动文件---arch/arm/plat-s3c24xx/adc.c,它是以平台驱动设备模型的架构来编写的,里面是一些比较通用稳定的代码,但是l ...
- [dpdk] 熟悉SDK与初步使用 (一)(qemu搭建实验环境)
搭建实验环境: troubleshoot 第一步加载驱动 第二步切换驱动 使用了所有qemu支持的卡 [tong@T7:~/VM/dpdk] % cat start.sh sudo qemu-syst ...
- Linux内核Makefile文件(翻译自内核手册)
--译自Linux3.9.5 Kernel Makefiles(内核目录documention/kbuild/makefiles.txt) kbuild(kernel build) 内核编译器 Thi ...
- [dpdk] 读官方文档(2)
续前节.切好继续: 一,文档里提到uio_pci_generic, igb_uio, vfio_pci三个内核模块,完全搞不懂,以及dpdk-devbind.py用来查看网卡状态,我得到了下边的输出: ...
- 通过 Autostereograms 案例学习 OpenGL 和 OpenCL 的互操作性
引言 在过去的十年里, GPU (图形处理单元)已经从特殊硬件(特供)转变成能够在数值计算领域开辟新篇章的高性能计算机设备. 很多算法能够使用拥有巨大的处理能力的GPU来快速运行和处理大数据量.即使在 ...
- Linux Kernel的Makefile与Kconfig文件的语法
https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt Introduction ------------ The c ...
- Exiting the Matrix: Introducing Metasploit's Hardware Bridge
Metasploit is an amazing tool. You can use it to maneuver through vast networks, pivoting through se ...
- AI_ 视频监控-人体移动捕捉监测
总目录地址:AI 系列 总目录 需要最新源码,或技术提问,请加QQ群:538327407 我的各种github 开源项目和代码:https://github.com/linbin524 需求 为了实现 ...
随机推荐
- Spring Boot修改内置Tomcat端口号
spring Boot 内置Tomcat默认端口号为8080,在开发多个应用调试时很不方便,本文介绍了修改 Spring Boot内置Tomcat端口号的方法. 一.EmbeddedServletCo ...
- PySpark 行列转换
Spark实现行列转换pivot和unpivot 背景 做过数据清洗ETL工作的都知道,行列转换是一个常见的数据整理需求. 首先明确一下啥叫行列转换,因为这个叫法也不是很统一,有的地方叫转置,有的地方 ...
- Java – How to join Arrays
Java – How to join Arrays In this article, we will show you a few ways to join a Java Array. Apache ...
- 下载必要的android sdk
做android自动化测试,必须要下载anroid sdk 下载后最少安装方法:
- 安装python 2.7条件下的pip环境
wget https://pypi.python.org/packages/ff/d4/209f4939c49e31f5524fa0027bf1c8ec3107abaf7c61fdaad704a648 ...
- php分享十八:网页抓取
一.抓取远程图片到本地,你会用什么函数? 方法1:利用readfile读取远程图片到缓冲中,然后写入新的文件 function grabImage($url, $filename = '') { if ...
- HBase随机读写
HDFS不太适合做大量的随机读应用,但HBASE却特别适合随机的读写 个人理解: 1.数据库一般都会有一层缓存,任何对数据的更改实际上是先更改内存中的数据.然后有异步的守护进程负责将脏页按照一定策略刷 ...
- oozie 常用命令
1.验证wokflow.xmloozie validate /appcom/apps/hduser0401/mbl_webtrends/workflow.xml 2.提交作业,作业进入PREP状态 o ...
- C语言浮点数存储结构
float类型占四个字节,每个字节占8位,总共32位,其内存结构如下图: 31位为符号位:0表示正数,1表示负数 31~23位:共8位表示指数位,内存存储数据从0~2^8-1=255,由于指数可以是正 ...
- IOS高访微信聊天对话界面(sizeWithFont:constrainedToSize和stretchableImageWithLeftCapWidth的使用)
大家好,百忙之中,抽出点空,写个微博,话说好久没写. 最近项目中有碰到写类似微信聊天界面上的效果,特整理了一下,写了一个小的Demo,希望给没头绪的同学们一个参考! 下载地址:http://files ...