As a part of my PoC project, I'm using single 5050 LED made by Adafruit. I wired it like this (LED - RPi):
- DI (Data Input) - SPI0 MOSI
- CI (Clock Input) - SPI0 SCLK
- GND (Ground) - GND
- VCC (5V) - 5V PWR
SPI is, as far as I'm concerned, is enabled - I've done it using raspi-config
and also added required line in /boot/config.txt
manually (I'm talking bout param=spi=on
)
Output of lsmod | grep spi*
command:
spidev 16384 0
spi_bcm2835 16384 0
And ls -la /dev/spi*
:
crw-rw---- 1 root spi 153, 0 Jul 29 19:17 /dev/spidev0.0
crw-rw---- 1 root spi 153, 1 Jul 29 19:17 /dev/spidev0.1
To try out my setup, I've launched python interpreter and wrote:
import spidev
spi = spidev.SpiDev()
spi.open(0, 1)
resp = spi.xfer([0x00, 0x00, 0x00, 0x00])
resp = spi.xfer([0xFF, 0xFF, 0xFF, 0xFF])
And nothing happened. What's important, I want to achieve my goal using Python. SpiDev module was installed at the time of the trials. For now, I'm only interested in simple blink, after this is reached, I can go further with modulation or frequency settings.
2 Answers 2
At best you may "SEE" MOSI signal AKA "chip select" to change state when SPI device is "selected". You are "looking at " default speed of probably 100kHz which is hardly observable by human eye. You MAY be able to slow down the SPI data transfer by programming for minimal clock speed.
-
I've tried changing spi speed by
spi.max_speed_hz = 1
, but still no luck, I guess that's not the cause.PotatoBox– PotatoBox2018年08月08日 16:04:33 +00:00Commented Aug 8, 2018 at 16:04 -
I just realized I told you to monitor wrong SPI signal. Put LED with limiting resistor on SS0 / CS0 chip select pin. Depending on configuration - it will "go low" (default) when you SPI port is selected. For better results put you SPI "transfer" code in a loop. Single flash is easy to miss.Jan Hus– Jan Hus2018年08月09日 13:37:50 +00:00Commented Aug 9, 2018 at 13:37
you are opened the wrong port.
spi.open(0,0) instead of spi.open(0,1) spi.open(0,1) means you are send data to SPI1 not SPI0.
Because you are send the data for wrong pin. That's why nothing happened.