<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Pi3 B+ with Stretch - MCP3008 SPI Not working</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/</id><updated>2020-02-27T16:06:51.090000Z</updated><subtitle>Recent posts to Pi3 B+ with Stretch - MCP3008 SPI Not working</subtitle><entry><title>Pi3 B+ with Stretch - MCP3008 SPI Not working</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/?limit=25#1648" rel="alternate"/><published>2020-02-27T16:06:51.090000Z</published><updated>2020-02-27T16:06:51.090000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com5e9956d8afb7a68016d9d30f055a0d6d9d8060fc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
thanks for this helpful information for the community, well appreciated.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Edwin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Pi3 B+ with Stretch - MCP3008 SPI Not working</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/?limit=25#7c62" rel="alternate"/><published>2020-02-27T16:06:50.299000Z</published><updated>2020-02-27T16:06:50.299000Z</updated><author><name>Anerdgy</name><uri>https://forge.codesys.com/u/anerdgy/</uri></author><id>https://forge.codesys.com5cd4f40589ed207bdbdbccd33b0e2c6f651c4ac8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Enable SPI1 on the raspberry pi in the config.txt&lt;/p&gt;
&lt;p&gt;Then add another device under the SPI and change the SPI port and MaxSpeed (due to stretch issue), move the MCP3008 into it.&lt;/p&gt;
&lt;p&gt;And all works. You can change the CS pin as well on the pi. &lt;/p&gt;
&lt;p&gt;I found this link useful . &lt;a class="" href="https://terminal28.blogspot.com/2016/05/enabling-spi1-on-raspberry-pi-bzero23.html" rel="nofollow"&gt;https://terminal28.blogspot.com/2016/05/enabling-spi1-on-raspberry-pi-bzero23.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Capture2.PNG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4110"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Pi3 B+ with Stretch - MCP3008 SPI Not working</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/?limit=25#7a63" rel="alternate"/><published>2020-02-27T16:06:48.077000Z</published><updated>2020-02-27T16:06:48.077000Z</updated><author><name>Anerdgy</name><uri>https://forge.codesys.com/u/anerdgy/</uri></author><id>https://forge.codesys.com9538798dba026c3c7bb33121aa876ac5eab86c83</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Pi3 B+ with Stretch - MCP3008 SPI Not working</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/?limit=25#8d27" rel="alternate"/><published>2020-02-27T16:06:47.283000Z</published><updated>2020-02-27T16:06:47.283000Z</updated><author><name>Anerdgy</name><uri>https://forge.codesys.com/u/anerdgy/</uri></author><id>https://forge.codesys.com3970dcbbba787d40cdfab89bb03a4725095d4a6b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://www.industrialberry.com/canberrydual-iso-v2-1/" rel="nofollow"&gt;https://www.industrialberry.com/canberrydual-iso-v2-1/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Many thanks&lt;/p&gt;
&lt;p&gt;Peter&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Pi3 B+ with Stretch - MCP3008 SPI Not working</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/?limit=25#4993" rel="alternate"/><published>2020-02-27T16:06:46.392000Z</published><updated>2020-02-27T16:06:46.392000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com70b34d6ae336038c53a7d43b33832c088771c0db</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
since Stretch fullspeed SPI does not work - so you need to reduce it here.&lt;br/&gt;
BR&lt;br/&gt;
Edwin&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: SPIMaxSpeed.jpg" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4108"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Pi3 B+ with Stretch - MCP3008 SPI Not working</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/3abf16c0cd/?limit=25#4cf3" rel="alternate"/><published>2020-02-27T16:06:43.478000Z</published><updated>2020-02-27T16:06:43.478000Z</updated><author><name>Anerdgy</name><uri>https://forge.codesys.com/u/anerdgy/</uri></author><id>https://forge.codesys.coma1dec311e4f8d7a42cfe562b1d90223fc51defd8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;am trying to get the MCP3008 to work with the Pi3 B+ using teh MCP3008 sample project.&lt;/p&gt;
&lt;p&gt;Unfortunately not receiving any readings. The hardware is defintely OK as with a python script I can read the values normally.&lt;/p&gt;
&lt;p&gt;I am using Hardware SPI.&lt;/p&gt;
&lt;p&gt;SPI master and devices running.&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;
&lt;p&gt;Peter&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Capture1.PNG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4107"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>