jgarff / rpi_ws281x

Userspace Raspberry Pi PWM library for WS281X LEDs
BSD 2-Clause "Simplified" License
1.78k stars 622 forks source link

Basic support for spidev1.0 and SPI1 over BCM20 (Feedback Wanted) #400

Closed Gadgetoid closed 4 years ago

Gadgetoid commented 4 years ago

Since I can't see any technical reason why it shouldn't be possible, this PR adds the necessary code to detect the use of BCM20 and switch to using /dev/spidev1.0

It's a bit rough around the edges, and could probably be accomplished more succinctly.

This requires "dtoverlay=spi1-3cs" in /boot/config.txt

My initial tests of this- without an oscilloscope or logic analyser to hand- suggest that something is being successfully output on SPI1, BCM20 and lighting up my 25 LEDs (or fewer if I configure it as such), but the data is mangled and the LEDs oversaturated. Additionally I'm running into https://github.com/jgarff/rpi_ws281x/issues/381, which is probably related.

Can anyone see something I've overlooked?

Gadgetoid commented 4 years ago

Okay this will also require the following in /boot/config.txt:

core_freq=500
core_freq_min=500

However, this does not fix the washed-out-flickering achieved on BCM20 using SPI1.

penfold42 commented 4 years ago

Does the Pi4 and kernel support DMA on the additional SPI interfaces ?

Gadgetoid commented 4 years ago

Good catch- no. Docs say "they have shallow FIFOs and no DMA support" which pretty much kills this changeset dead in the water. So close, yet so far!