Posts: 27
Joined: Tue Mar 26, 2013 5:06 pm

SPI on raspberry pi zero (same sd card from raspberry pi a+/

Wed Jan 13, 2016 5:00 pm


I got a new raspberry pi zero.

I copied the same sd card from my old raspberry pi A+ and it doesn't boot.


Code: Select all

sudo rpi-update
This will fix this problem. Now raspberry pi zero boots from my sd card.

Current firmware version:

Code: Select all

Linux test 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux
The problem that I have is that my RF module is not working with the SPI.

SPI is enable in the raspberry pi zero:

Code: Select all

pi@test /ISGv2 $ lsmod
Module                  Size  Used by
ctr                     4001  2 
ccm                     8278  2 
bcm2708_wdog            3926  1 
snd_bcm2835            22317  0 
arc4                    1972  2 
rt2800usb              18832  0 
rt2800lib              81962  1 rt2800usb
rt2x00usb              11918  1 rt2800usb
rt2x00lib              47910  3 rt2x00usb,rt2800lib,rt2800usb
snd_soc_bcm2708_i2s     7566  0 
regmap_mmio             3556  1 snd_soc_bcm2708_i2s
snd_soc_core          168662  1 snd_soc_bcm2708_i2s
snd_compress            8809  1 snd_soc_core
snd_pcm_dmaengine       5778  1 snd_soc_core
mac80211              622304  3 rt2x00lib,rt2x00usb,rt2800lib
snd_pcm                92581  3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_seq                61957  0 
snd_seq_device          5130  1 snd_seq
snd_timer              23454  2 snd_pcm,snd_seq
cfg80211              499834  2 mac80211,rt2x00lib
crc_ccitt               1620  1 rt2800lib
rfkill                 22491  2 cfg80211
snd                    68161  7 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
spi_bcm2708             6041  0 

More info about SPI:

Code: Select all

pi@test /ISGv2 $ ls -la /dev/spi*
crw------- 1 root root 153, 0 Jan  1  1970 /dev/spidev0.0
crw------- 1 root root 153, 1 Jan  1  1970 /dev/spidev0.1
About config.txt:

Code: Select all

#for more options see http://elinux.org/RPi_config.txt


#disable Device Tree


The error that I have is (from c++ program):

Code: Select all

Error - Problem transmitting spi data..ioctl: Invalid argument
Any ideas?

Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5284
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SPI on raspberry pi zero (same sd card from raspberry pi

Tue Jan 26, 2016 8:49 am

Why do you disable Device Tree? It makes the dtparam=i2c=on completely pointless. Booting without DT is not going to be an option in the near future, so it's better to get used to it now (and to ignore any "HowTo"s that tell you to do it).

However, I don't think that is your problem. It is much more likely that the C++ code or application isn't fully initialising the struct spi_ioc_transfer. In particular, the "pad" field needs to be zeroed. See the rest of this thread for more information.

Return to “Device Tree”