Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI LEDs Stuck White #447

Open
robert-nash opened this issue Feb 18, 2021 · 7 comments
Open

SPI LEDs Stuck White #447

robert-nash opened this issue Feb 18, 2021 · 7 comments

Comments

@robert-nash
Copy link

Hello,

I've been having some awful difficulty trying to get some LED strips to work using SPI. Everything works fine using PWM (GPIO 18) but if I use SPI (GPIO 10) the LEDs will only turn white and then won't turn off.

Only LEDs that are meant to turn on turn on. I.e. if I run the test script to run on 8 LEDs, 8 will turn on just they are white at what appears to be full brightness. They then won't turn off without removing the power to the LEDs.

Unfortunately I am stuck using GPIO 10 as it is the only suitable pin I have remaining because I need to use the other pins for driving a separate LED matrix (the problem persists even when the matrix is not involved).

I am using a raspberry pi 3 B+ and I have added core_freq=250 to config.txt. Other issues seem to ask about level shifters so for what it's worth I am using a TXS0108E.

I know that this isn't a whole load of information to go on but if someone could point me in the right direction that would be much appreciated.

@GAEGAEGAE
Copy link

same proble. somebody help me

@haenno
Copy link

haenno commented Aug 8, 2021

Same here. Raspi Zero W.

@lbt
Copy link

lbt commented Aug 16, 2021

I had the same issue (edit: on a Raspberry Pi Zero W)

The SPI pin 10 works for a short while (about 1 second) and allows a few leds to change but then they go all white.
PWM on 18 with sudo works fine.

I found that doing some 'work' on the pi would make the LEDs flicker... turns out the cpu scaling was the issue as per the Pi 3 comments.

Quick test with

echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

and SPI is working perfectly 🙂

I couldn't find an option for /boot/config.txt so to make it work on every boot I did:

apt install sysfsutils
echo /devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 1000000 > /etc/sysfs.d/99-cpu-min.conf

@francescofact
Copy link

Other solutions?
The echo mentioned didn't solve anything. I'm on Pi 4B 1GB

@lbt
Copy link

lbt commented Sep 4, 2021

The values for a Pi 4 are different - I don't know what's needed there (yet).

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

to see the values available and then try using approptiate echos to set min and max in that directory to those values and see which ones work.

Eg try this on a Pi 4:

echo 1500000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

This will keep the Pi running at top speed all the time though, You may want to try:

echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

if that is fast enough

@Old-Engineer
Copy link

Old-Engineer commented Oct 30, 2021

Hi
I had similar problems using SPI on my pi4B. Studying the read me info gave the answer that worked for me.

Add the following lines to /boot/config.txt and reboot:
core_freq=500
core_freq_min=500
Good luck

@lbt
Copy link

lbt commented Jan 7, 2022

Changing the values in boot/config.txt has a very similar effect but needs a reboot to change. The kernel frequency governor is tweakable whilst running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants