Hi Alan,
Thanks for adding Brennan to the discussion.

My answers below.

Le lun. 30 oct. 2023 à 16:09, Alan C. Assis <acas...@gmail.com> a écrit :

> 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?

--> I forgot to activate board_late_initialized
--> By default the ws2812 driver allocate memory for each color (8bits) for
RGBW (4 colors). My leds are RGB only so I had to change 4->3. I will try
to add a parameter instead of a fixed value.

>
> > 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)
>
--> True! I will try to fit the target by changing the clock without
changing the bits


> > 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.

--> Ah! I thought it was already using DMA. Now I understand that the delay
should be the cpu time needed to send the next bit.
--> Yes using the DMA would definitely improve the driver. I checked on
another library that it is possible to loop on DMA so when there is no data
to send, it sends zeros forever at no cpu cost.
--> I have no idea how to handle and allocate DMA. I saw a DMA trigger in
the SPI option, will it be necessary to activate? I will try to add the DMA
option in the driver.

>


> > - 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
>

Regards,
Bertrand.

Reply via email to