I'm trying to use mcp3008 to read signal form analog sensor.
For wiring I used instructions from this address: http://www.raspberrypi-spy.co.uk/2013/1 ... n-mcp3008/
I performed software and firmware update. SPI is enabled in raspi-config. Python libraries are installed.
My problem is that all examples returns 0 no mater what is happening with my ch0 input.
root@raspberrypi:/home/pi# uname -a
Linux raspberrypi 4.1.17+ #843 Mon Feb 15 23:17:46 GMT 2016 armv6l GNU/Linux
root@raspberrypi:/home/pi# ls /dev | grep spi
spidev0.0
spidev0.1
I can modprobe spi_bcm2835 and spi_bcm2708 without any problems.
In /boot/config.txt, on end I have this:
Code: Select all
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtoverlay=spi-bcm2708-overlay
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
# Additional overlays and parameters are documented /boot/overlays/README
dtparam=i2c_arm=off
core_freq=500
sdram_freq=500
over_voltage=2
dtparam=spi=onroot@raspberrypi:/home/pi# lsmod
Code: Select all
Module Size Used by
arc4 1956 2
rtl8187 53210 0
eeprom_93cx6 4106 1 rtl8187
mac80211 595863 1 rtl8187
cfg80211 479279 2 mac80211,rtl8187
rfkill 21544 2 cfg80211
snd_soc_bcm2708_i2s 7654 0
regmap_mmio 3556 1 snd_soc_bcm2708_i2s
snd_soc_core 167413 1 snd_soc_bcm2708_i2s
snd_compress 8861 1 snd_soc_core
snd_pcm_dmaengine 5794 1 snd_soc_core
spi_bcm2708 5685 0
bcm2835_gpiomem 3703 0
bcm2835_rng 2207 0
uio_pdrv_genirq 3526 0
uio 10078 1 uio_pdrv_genirq
spi_bcm2835 7868 0
rtc_ds1307 10459 0
i2c_dev 6386 0
snd_bcm2835 22502 6
snd_pcm 92829 3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_timer 21936 1 snd_pcm
snd 67534 17 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_compress
fuse 86348 5
ipv6 358702 26When I join MISO and MOSI:
Code: Select all
root@raspberrypi:/home/pi# ./spidev_test -D /dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0Droot@raspberrypi:/home/pi# ./spidev_test -D
Code: Select all
/dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00