-
Notifications
You must be signed in to change notification settings - Fork 203
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
Neopixel examples are problematic #752
Comments
#800 Fixes neopixels when using SPI without DMA. |
Should we close this then or are there other cases we need to test first? |
I think at this point it's just a matter of reinstating the neopixel examples in the pygamer BSP - we had temporarily removed them to avoid shipping broken examples. I'm not sure if other BSPs would also benefit from using SPI rather than bitbanging the protocol. |
Before this issue gets closed, I 'd like to point out that wile we seem to be gravitating towards using SPI to drive our neopixel examples, there could be other ways to drive them using hardware acceleration. One that comes to mind is using PWM while also using DMA to set the correct timer compare value according to whether we're sending a 0 or a 1. It would certainly use more memory than (ab)using SPI, but it would allow one to avoid unnecessarily tying up a clock pin in the SPI driver. It would definitely be a little cursed, but it could be a fun exercise. |
I think this should stay open as long as we use the timer-based WS2812 driver for examples, as it's going to remain a point of friction. |
I think the SERCOM is well suited, just not through a generic SPI interface like the ehal traits provide. The TC/TCC seems like a viable option too, at least for the pygamer. |
Do you mean in Tier 1 BSPs only? I just checked, and the remaining T1 BSPs that have a neopixel example are |
I guess this depends on whether we want to use the tracker for tier 2 BSPs, perhaps a wider discussion really - AFAIK there's no other tracker that would be appropriate for the tier 2 BSPs at the moment. My feeling is that the timer based neopixel driver was a good test case for early Rust firmware work, and is still handy for hobby use, but it's not something I'd want to support long term.
Here's a table for the current T1 BSPs - if we had a TC implementation we'd be set. I like the idea of supplying an example driver that talks to a PAC directly, and maybe this is a good case to make one. This would look like a new crate eg
* SERCOM on SAMD51 can output data on pads 0 and 3 only |
In #750 I've been working on updating PyGamer to the current HAL, and I'm finding that the WS2812 / neopixel is a tricky problem to solve generically. In the timer-based WS2812 driver, there's a fundamental issue with the time it takes to toggle a GPIO varying between platforms, and also being comparable to the protocol's timing margins. The SPI driver relies on behaviours of the provided
SpiBus
which aren't described by the trait (nor reliably provided by our current implementation).So, it's not really clear to me how we should proceed here. A few ideas:
SpiBus::write()
- this would minimise the variation in bit timing to any particular WS2812, and hopefully it doesn't matter as much for the data between WS2812s.DelayNs
(in progress), we could possibly introduce a parameter for the time that a GPIO write takes, to allow tuning for the particular board.The text was updated successfully, but these errors were encountered: