0
我正在寫一個沒有iio支持的mcp3008設備驅動程序以用於學習目的。我已按照此鏈接pin connections。我已附上我的source code。要通過mcp3008(spi)上的定製驅動程序讀取TMP adc傳感器數據在樹莓派上
驅動被成功地結合到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通道1。我正嘗試讀取sysfs條目中的模擬值(/sys/bus/spi/devices/spi0.1/aartyaa_mcp3008)。
我曾嘗試給3通道以及3V3。但我無法讀取adc值。 dmesg is 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值。 任何幫助將不勝感激,並非常感謝。