mcp3008 spi loopback tests

Viewed 5 times

I’ve been messing with raspberry pi, and I am learning about interfacing it with analog devices. I am using the MCP3008 for that and following this tutorial here. I wired it up like the pictures below: enter image description here enter image description here

I did all of the required things to set up spi devices such as: 1) enable spi in raspi-config 2) uncommented dtparam=spi=on in config.txt. 3) ls /dev/sp* says /dev/spidev0.0 and /dev/spidev0.1

Everything to me seems correct, but the output from a potentiometer is still 0 no matter what i do with it. can anyone spot the problem?

 New contributor
  • Hi @Aubrey Champagne, Welcome and nice to meet you. Ah, let me see. (1) You setup looks correct. (2) For newbies, I usually suggest to do SPI “loop back” test first, to make sure SPI software and hardware (hardware wiring correct, no poor electrical connect, broker jumper wires (sometime bent too often and broken inside and not visible outside). – tlfong01 12 mins ago
  • If you have a multi-meter, you can try “open, short” tests, ie, all point to point connection are shorted (very low resistance, approaching zero), and neighbour points are open, ie not “stuck” together, therefore very very high resistance, approaching 10Mega ohm. – tlfong01 12 mins ago
  • You can google for “UART”, “serial”, “SPI” loop back test to get a rough idea what is meant by loop back, and the setup (For SPI, MOSI (output) connected/shorted to MSIO (input). then send something out to MSOI, and read back from MISO. If send characters are echoed, loopback to input, then basic steup is OK. WARNING, usually basic out to input short test does NOT check CS pin operation, so not 100% proof. – tlfong01 8 mins ago
  • For spi loopback tests in Rpi python 3.5x and 3.7x, you can search this forum using key words “SPI”, “loopback”. If you add the search word “tlfong01” you might find a couple of my answers with loopback python test programs, colourful waveforms illustrating the CLK, MOIS, MISO, CSn waveforms. You don’t need to understand the details of the programs. My programs are “plug and play/run” no library is required. Though you need to “uncomment” to select slight variation of loopback, say one, two, or three characters, or control characters such a <control x> etc. Happy testing, cheers! – tlfong01 49 secs ago   Edit

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

<span>%d</span> bloggers like this: