2022-11-16 05:26 AM
We try to generate audio signal with 2 PWM signals. We use TIM2_CH1 and TIM2_CH2 with DMA1 channel 5 and channel 3. This two PWM signals must be synchronized, but we noticed some delay between this 2 channels, which unfortunately is not constant. For example we have 5th value at channel 1 and 1st value at channel 2. How can we deal with this?
2022-11-17 01:07 AM
Set up the two DMA channels first, and only after that start the timer.
Better, use the TIMx_DMAR/DCR mechanism and a single DMA channel triggered by timer Update (you'll need to have the values interspersed in a single array).
Generally, if you cannot click it simply in CubeMX, it's likely that Cube will get into your way, so you may be better off by ditching Cube and writing your own program. In any case, you should start with reading the TIM and DMA chapters in RM.
JW