-
Notifications
You must be signed in to change notification settings - Fork 29
Rare glitches on WS2812B pixels using neopixel library on micro:bit V2 #227
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
Comments
Worth mentioning I've tried some longer runs now and very similar code (I've reduced the amount of memory allocations a bit) if left for about 11 hours can give a |
Can you post simple example that triggers the error? |
@martinwork I'll try making some cutdown versions to see what they do. I have a load of spare hardware now so I can do a few tests with and without i2c chatter in parallel to speed up finding a small reproduction. |
Some updates
Both bits of software have the LEDs at relatively low brightness levels which probably explains why any corruption makes them brighter and appear to flash. I sometimes notice the flash if it's on my desk, it's easier to observe in a fairly dark room. It's possible it can be detected with For background on what I'm up to, see Instructables: Making an Accurate Stylish Clock With the Kitronik ZIP Halo HD and a BBC Micro:bit in MicroPython. |
I've had one device out of three after a day and a half give an I've also confirmed that a micro:bit V2 on its own will (as expected) produce |
I wrote some code (neopixel-thirty-bug-detector-8.py) to try and detect the bright flash from the change in previously low RGB values that's common with these glitches. It uses |
I tried this (from #83 (comment)) and assuming I got the right details for
|
I tweaked my flash detection program to set some others pins to make it easier to get some logic captures. I only have a humble Ikalogic SQ25 which doesn't have enough local memory to be able to capture many neopixel show() data bursts and decode them. I dropped it to 1Msps (obviously too slow to decode 800kbps data) and caught 4 shows() before the I can measure them from the approximate start to finish and from my first capture like this it appears that the penultimate one is short and perhaps has a few prolonged high periods in the middle which is a clear protocol bogosity. The approximate lengths of those from left to right are 1.78ms, 1.79ms, 1.43ms and 1.80ms. This trace happens to matches the previous testing where the flash causes the program to stop but the LEDs aren't left in a glitched state. |
I tightened up the loop a bit in the program by removing stuff and fortunately it still glitches. I managed to capture two ZIP LED updates at 10Msps showing a similar trace with the short transfer to the previous comment. I think the protocol decode could be slightly unreliable at 10Msps as its matching the timing but here you can see an obvious deviation from the protocol with the "big square wave" with period 20.2us. The |
Is https://github.com/lancaster-university/codal-nrf52/blob/master/source/neopixel.cpp the code that provides the functionality for the |
Based on the 1.45ms short output observed previously I've got a new detection program which looks for Should I open an issue in https://github.com/lancaster-university/codal-nrf52 for this? |
Wow, thank you for the detailed analysis @kevinjwalters!
We generally recommend all micro:bit CODAL issues to go to https://github.com/lancaster-university/codal-microbit-v2, as that is only CODAL repository for micro:bit actively monitored. Creating an issue there with the summary of findings would be really appreciated!
In the micro:bit V2 case
I haven't looked in detail at this, but the assumption was that the "hardware" version generates the 1-wire signal via the PWM hardware peripheral in the micro:bit V2 (V1 didn't have one) and it shouldn't be affected by interrupts, unless they somehow touched the same PWM peripheral. |
@microbit-carlos @martinwork I put some fresh traces in a new ticket in the appropriate codal repo lancaster-university/codal-microbit-v2#475 with a summary of what tested before hand. I now suspect the number of pixels has an effect on the errors. |
I caught an (impressive) glitch in a recent video of the 60 RGB pixels on a Kitronik ZIP Halo HD at 04:25. There are two video frames at 25fps of it.
I see these perhaps every 10-15 minutes, the code is updating the ring all the time at about 5 to 25 Hz with
show()
method. This might be happening perhaps 1 in 10000 updates. I don't think there's anything particularly exotic about the code. It uses theneopixel
library and i2c comms to an external MCP9740N. This is on a V2.2.1 board runningMicroPython v1.18 on 2023-10-30; micro:bit v2.1.2 with nRF52833
.My best rather uninformed guesses so far:
The documentation mentions:
This board has 60 so is well under that limit. Why is there an issue above 256?
(@DaveAtKitronik @AlasdairAtKitronik @JackAtKitronik might be interested in this.)
The text was updated successfully, but these errors were encountered: