Open ancher-bohdan opened 5 years ago
It seems that after subsequent call, the data is shifted to 1 left.
Besides, this shift is circular. After I send via this function all led strip to green color (128), first call cause right behavior, but all subsequent set led strip to blue (1)
After disabling circular mode for DMA, I have got more strange result. Now data is shifted 1 right....
I think I got it.
After last byte was transfer via DMA to timer`s CCR, this value is saved until subsequent DMA transaction rewrite it. I think there is a small gap between transition of new byte to CCR and starting timer. This gap leads to stalled value is used to transmit first PWM pulse. This staled value is mess up all bit sequence for led strip.
It is strange, but my previous assumption was wrong. There are nothing change after I clean timers CCR register
I think I found temporary workaround for this issue. It is possible to enforce DMA send one dummy byte, before actual led data. This leads to swallowing one dummy byte and transmitting only correct data.
I will create a patch with this solution. In future I must investigate this more carefully and rewrite solution for this
Workaround for this issue is in #5
This pull request contain commit (the last one) that add before any transition to led strip, one buffer, fill by 0. Therefore, before any transmission, micro-controller will send some amount of pulses with 0 pulse with.
So far it is working, but I am need to investigate for more efficient solution
It seems, that solution with sending one dummy buffer with zeros was not so bed. It allows to get rid of strange behavior of ws2812 ledstip and guarantee, that reset sequence will be present before any new transaction.
This approach was successfully implemented in release-2.0 (commit hash 6502f81).
I am afraid, this issue is related to ws2812 controller. Need additional investigation.
Still help wanted!
When I call mentioned function at the first time everything working as expected. But after new call, the data is corrupting.