Hi Bert, I'm CC Brennan (the original author) and Victor (the author of the other driver using ESP32 RMT) they have more experience with WS2812.
On 10/29/23, Bert Voldenuit <bertvolden...@gmail.com> wrote: > Hi Alan, > > Thanks to your advices, I was able to find why board_ws2812_initialize() > was not in System.map. > Now it mounts and opens ws2812 driver. > Great, what was the issue? > Indeed the SPI is not a piece of cake. I think I have it almost right but > MOSI pin is idling high which is a problem for the reset which must be low > and I can' get it to the right timing. > Exactly, using SPI to control the WS2812 seems challenging, you will need to fiddling with it a little bit until get things working. > SPI frequency is set to 6MHz > > In ws2812.c > I had to change WS2812_ONE_BYTE. I added one more 1 to fit the timing for > SK6812 > Target Measured (see Scope figure 1) > T0H 0 0.3μs ±0.15μs 0.34µs > T1H 1 0.6μs ±0.15μs 0.68µs > T0L 0 0.9μs ±0.15μs 0.86µs > T1L 1 0.6μs ±0.15μs 0.52µs > Reset 80µs 20µs (Not Good) > I'm not sure you need to change the number of bits, AFAIK it should be only the frequency you should play with. SAMD21 (and many others SAM chips) has a very advanced clock system (even compared with some advanced processor) > I Changed WS2812_RST_CYCLES for 80µs but I still get 20µs, so it look like > it has no effect AND it is idling High (see Scope figure 2). > > Questions: > > - On Scope Figure 1, is it normal SPI is idling for 2.2µs between each > byte? > It could be caused by the driver itself. Maybe using SPI with DMA will reduce this idle time. > - Is there a way to set idling Low Level? I looked in the datasheet but... > It looks like it is always high. > I didn't find this option in the SPI_HWFEATURES. > - Should I create a WS2812_RESET_BYTE 0b00000000 and send x time so it fits > 80µs?? > I think it could be an option. Brennan, what do you think? BR, Alan