jgarff / rpi_ws281x

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

TinkerBoard #348

Open ghost opened 5 years ago

ghost commented 5 years ago

Hey I`m trying to get this working on the TinkerBoard, I have added the revision in the file but I still get the error. Any ideas?

usefulthink commented 5 years ago

As far as I know, this library is explicitly built to work with the system-on-chip used by the raspberry-pi (Broadcom BCM2835 and so on) only. It is very unlikely, that the SoC used in the TinkerBoard (Rockchip RK3288) would be compatible with that.

Main reason is that the library directly accesses some aspects of the processor via memory-mapped I/O (DMA, PWM and PCM) and even if other processors provide the same features they are unlikely to use the exact same memory-adresses.

ghost commented 5 years ago

Thanks for the reply. Any suggestions on how to get it working considering It has a pwm pin just like the rpi? I saw there is some Java code

usefulthink commented 5 years ago

That's gotta be very hard to do, pretty close to rewriting the entire library. You will at least need to understand all the ways this library interacts with the hardware via mmio and study the processor-reference for the RK3288 (if you can find them) to find the corresponding features, hoping they are even available (which isn't granted).

usefulthink commented 5 years ago

I found the document here: http://opensource.rock-chips.com/images/8/8f/Rockchip_RK3288_TRM_V1.2_Part1-20170321.pdf and had a quick look at it.

This library controls the signals generated by the PWM generators from a chunk of memory via DMA, and it seems that the RK3288 doesn't support operating the PWMs in that manner, so this will probably not work. I think there was another way to output data to the LEDs using PCM or something like that, but I haven't had a look at how exactly that works.

Anyway, you might be better off looking for alternative libraries for your board or implement something similar yourself.

penfold42 commented 5 years ago

SPI should work

usefulthink commented 5 years ago

In that case, I stand corrected.

For a better understanding, this is because linux/spi/spidev.h abstracts hardware-differences away?

EDIT: what about the address and memory-layout in gpio.h? That doesn't look like it applies to other SoCs?

penfold42 commented 5 years ago

Yes - let the OS do the heavy lifting. This does however require that the OS and SPI drivers support DMA to ensure the timing

SteMMo33 commented 5 years ago

Hi all, I'm interested to port the library on Tinker, too. Or, did anyone find an alternative ?

SteMMo33 commented 4 years ago

Hi all, I'm able to run on Tinkerboard. I selected the SPI channel and, tailing the source code, I'm able to compile library and test application. I see the data on the scope but the signal is not suitable for the strip: usually after a block of data 32us long, the data presents some delay/hole and the chips do not understand the sequence.

penfold42 commented 4 years ago

SPI support assumes the Linux kernel will use DMA to ensure no gaps in the data.

If the tinker board SPI interface or the kernel driver doesn’t do DMA (and DMA with a long buffer) this won’t work.

SteMMo33 commented 4 years ago

I'm using a Linaro distribution or a Armbian OS.