I am trying to control two lines of digital LEDs (WS2812b) with my STM32F103 using Timers with DMA and PWM. LED strips data lines are connected to PB5
and PB6
of the MC. I used STM32CumeMX to create the inital code for my project.
I click channel 1 and set it to "PWM Generation CH1". PB6
tuns green and
in DMA settings it says TIM4_CH1
and DMA1 Channel1
. Looks OK, and it works.
But when I try to configure PB5 weird stuff happens:
I select TIM3 and Channel2. PA7
turns green(!?). I click PB5
and select TIM3_CH2 manually. The black pin appears next to it. In DMA settings it says TIM3_CH4/UP
(!??) and DMA1 channel 3
(!???). What is the logic here? What does /UP
even mean? Where are all possible combinations of Timer/DMA channel are listed?
As the result PB5
does not work.
Also I noticed that CubeMX produces this:
/* Several peripheral DMA handle pointers point to the same DMA handle.
Be aware that there is only one channel to perform all the requested DMAs. */
__HAL_LINKDMA(tim_baseHandle, hdma[TIM_DMA_ID_CC4], hdma_tim3_ch4_up);
__HAL_LINKDMA(tim_baseHandle, hdma[TIM_DMA_ID_UPDATE], hdma_tim3_ch4_up);
I deleted the last line, but it didn't help. I just want to configure PB5
similarly to PB6
. What am I missing here?
Is it possible to use DMA on PB5
at all?