我正在编写一个没有iio支持的mcp3008设备驱动程序用于学习目的。我已关注pin connections的此链接。
我附上了source code。
驱动程序成功绑定到spi subsys,dmesg为
[ 9.053293] bus: 'platform': driver_probe_device: matched device soc:audio with driver bcm2835_AUD0
[ 9.053316] bus: 'platform': really_probe: probing driver bcm2835_AUD0 with device soc:audio
[ 9.103796] driver: 'bcm2835_AUD0': driver_bound: bound to device 'soc:audio'
[ 9.103843] bus: 'platform': really_probe: bound device soc:audio to driver bcm2835_AUD0
[ 11.703933] systemd-journald[116]: Received request to flush runtime journal from PID 1
[ 13.170530] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[ 14.801684] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
[ 16.057113] Adding 102396k swap on /var/swap. Priority:-1 extents:3 across:1773568k SSFS
[ 26.739940] random: crng init done
[ 66.338696] bus: 'spi': driver_probe_device: matched device spi0.1 with driver aartyaa_mcp3008
[ 66.338720] bus: 'spi': really_probe: probing driver aartyaa_mcp3008 with device spi0.1
[ 66.338831] aartyaa_mcp3008 spi0.1: aaartyaa came in probe, master dev = spi0
[ 66.338845] aartyaa_mcp3008 spi0.1: mcp3008_device_alloc : devres is allocated
[ 66.338855] aartyaa_mcp3008 spi0.1: mcp3008_device_alloc : dev is added to devres
[ 66.338864] aartyaa_mcp3008 spi0.1: mcp3008_probe : trasefer buffer is ready
[ 66.338871] aartyaa_mcp3008 spi0.1: mcp3008_probe : initing spi msg
[ 66.338881] aartyaa_mcp3008 spi0.1: mcp3008_probe : creating sysfs for mcp3008
[ 66.338912] driver: 'aartyaa_mcp3008': driver_bound: bound to device 'spi0.1'
[ 66.338946] bus: 'spi': really_probe: bound device spi0.1 to driver aartyaa_mcp3008
我已将TMP36连接到mcp3008的channel1。我试图在sysfs条目中读取模拟值(/sys/bus/spi/devices/spi0.1/aartyaa_mcp3008)。
我试过将3V3给予channel1。但我无法读取adc值。 dmesg是as =>
[ 101.311640] aartyaa_mcp3008 spi0.1: mcp3008_aartyaa_show_data
[ 101.311807] aartyaa_mcp3008 spi0.1: mcp3008_conversion : ret = 0
[ 101.311822] aartyaa_mcp3008 spi0.1: mcp3008_aartyaa_show_data : ret = 0
如何使用此驱动程序读取mcp3008上的TMP36 adc值。 任何帮助将不胜感激,非常感谢。
答案 0 :(得分:0)
对由此带来的不便表示遗憾。 电路板上错误地连接了CE和差分引脚。
驱动程序正常运行。
感谢。