Closed csorvagep closed 5 years ago
Hello @csorvagep,
I think implementation is ok. If you look, first I set data for both first leds and I start DMA.
Once HC is first time triggered, I increase current_led
(line 389) and if you check if statement later on line 406
, it sets new data to first buffer if: current_led == 0 or !tc
.
If !tc == true
, it was HT event.
Tests I did with LED show proper color moving. That's why I'm pretty sure it is ok. Of course, I'm open to correct if there is a bug.
Hello @MaJerle,
Sorry for the issue, you are correct and it worked in debug as you suggested. Unfortunately I wanted to port this to an STM32F030K6 controller, but did not work, the duty cycles were off. Maybe the MCU is too slow for the DMA transfer. Anyway, thanks for your help and the quick answer.
Hi!
Unfortunately I haven't had time to test the code in real hardware, but it seems, there is an error in the data loading for the third LED. As I understand the code, when the first reset pulse is done, the first half of the buffer is set (main.c:407), the current_led is incremented, the second half is also filled later and the DMA is initailzed (main.c:421).
After the first HC interrupt the current led is incremented again to the third LED (current_led == 2, after line 389), but the data filled in the second half of the buffer (line 409) because this is only a HC interrupt.
Is there something wrong with my logic? I'll test the code and as soon as I can to confirm it.