nrf: neopixel_write: busy poll for one pixel writes #2319
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's probably not the whole story, however, this fixes a crash observed when bulk copying data to an nRF board using
dd
.Basically, the call stack looked like this when resetting into safe mode:
i.e., during early startup, it is not okay yet to call allocation functions like m_malloc_maybe that use the garbage collected heap. However, nRF's neopixel_write (which already includes special handling to avoid heap allocations for the status pixel!) can enter background tasks, which do nearly arbitrary things including heap allocations.
We re-use the same test that switches from heap allocation to stack allocation for the pattern buffer (just with the opposite sense)
Testing performed: on an nRF52840 feather, repeatedly
dd if=/dev/zero bs=512 count=100 of=/media/jepler/CIRCUITPY/zero conv=fdatasync status=progress
. Before this change, at least 50% of trials would cause the board to disconnect from USB and enter safe mode; after this change, 10 iterations completed without trouble.