Open BryceBeagle opened 2 years ago
I've encountered the same issue while driving WS2812B using SPI. No matter what I did, I couldn't get the lights to work properly.
After using an oscilloscope, I found that spi.write
will cause SCK stops for a period of time after each byte is sent.
I was able to work around the issue by using DMA transfers instead.
If I try to
.write
more than a certain number of bytes[1] (exactly) in a single call/packet, theSCK
signal stops working properly, hiccuping at regular intervals and preventing the data from getting sent. A couple other users on the Embedded Rust matrix server reported having similar issues and it was requested that I open an issue for this.I am using an
stm32f103
bluepill. I have tried with both thev0.9.0
release of the HAL and the head of master (f063d5bef at time of writing).[1]: With
opt-level = 2
this is >13 bytes; withopt-level = 3
this is >28 bytes. These numbers are exact and deterministic13 bytes of
0b10101010
atopt-level = 2
:14 bytes of
0b10101010
atopt-level = 2
:Reproducible snippet: