W0rmSp17
Posts: 13
Joined: Tue Mar 03, 2015 2:20 pm

GPIO SPI help

Fri Mar 06, 2015 6:51 am

How can I tell if I have enabled SPI on my r-pi. I followed a guide but, im not sure if it worked. Thank you

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO SPI help

Fri Mar 06, 2015 7:44 am

Check that /dev/spidev0.0 and /dev/spidev0.1 exist.

e.g.

Code: Select all

$ ls -l /dev/spi*
crw-rw---T 1 root spi 153, 0 Jan  1  1970 /dev/spidev0.0
crw-rw---T 1 root spi 153, 1 Jan  1  1970 /dev/spidev0.1

W0rmSp17
Posts: 13
Joined: Tue Mar 03, 2015 2:20 pm

Re: GPIO SPI help

Fri Mar 06, 2015 7:52 am

Oh thank you so much. I have executed this command in terminal before, and they do exist, I didn't realise though that, that mean't SPI was enabled. Is there any command that allows you to see which pins are active, or do I have to program that function?

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO SPI help

Fri Mar 06, 2015 8:16 am

The pins won't be active until you have actually opened the SPI device (open call, CE0/1 will go high) and you are actually reading/writing data (read/write calls, CE0/1, SCLK, MISO, MOSI will be active).

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: GPIO SPI help

Fri Mar 06, 2015 8:36 am

A useful SPI "Hello World" is the loopback test. See http://elinux.org/RPi_SPI#Loopback_test

W0rmSp17
Posts: 13
Joined: Tue Mar 03, 2015 2:20 pm

Re: GPIO SPI help

Fri Mar 06, 2015 10:16 am

joan wrote:The pins won't be active until you have actually opened the SPI device (open call, CE0/1 will go high) and you are actually reading/writing data (read/write calls, CE0/1, SCLK, MISO, MOSI will be active).
Yes, thank you. I just read all about SPI. I think I understand how it works. I was able to confirm its running smoothly, my device and code are working. Thank you again.

Return to “Beginners”