am trying to get the MCP3008 to work with the Pi3 B+ using teh MCP3008 sample project.
Unfortunately not receiving any readings. The hardware is defintely OK as with a python script I can read the values normally.
I am using Hardware SPI.
SPI master and devices running.
Thanks in advance
since Stretch fullspeed SPI does not work - so you need to reduce it here.
Many thanks. That solved it. I'm curious as to why the hardware code using the Adafruit python code worked as I had not changed the SPI speed.
Secondly, how do I change it to use the second SPI hardware pins? ie using a differnet GPIO as chip select, BCM19 pin 35 MISO, BCM20 pin 38 MOSI and BCM21 pin 40 SCLK as I will now purchase a canberry dual board to mount and it is already using the original SPI pins as well as CE0 and CE1. Maybe I could just use a different GPIO for chip select , but if it affects the timing, maybe easier to move all the MCP3008 work onto the second SPI pins.
Through trial and error it seems that the max SPI clock speed is 7.8Mhz. If I go higher eg 15.6Mhz, I get a reduced scale and it no longer reads the values correctly.
Enable SPI1 on the raspberry pi in the config.txt
Then add another device under the SPI and change the SPI port and MaxSpeed (due to stretch issue), move the MCP3008 into it.
And all works. You can change the CS pin as well on the pi.
I found this link useful . https://terminal28.blogspot.com/2016/05/enabling-spi1-on-raspberry-pi-bzero23.html
thanks for this helpful information for the community, well appreciated.
Log in to post a comment.