0
votes

MCU: f446rct6 System: freertos Library: hal

Program logic:

  1. Initialize the timer to output the PWM wave and initialize the DMA and connect to the Capture/Compare register
  2. Start the timer
  3. When data needs to be updated, start a dma transmission

Phenomenon: There is no problem with the frequency and duty cycle of the PWM wave, but a strange triangular waveform often appears in the first or second waveform of DMA transmission.

Ask everyone, do you encounter similar waveforms when using pwm? Please give me a hint to locate this problem, thank you

Pin's output oscilloscope trace

1

1 Answers

0
votes

Potential causes include:

  1. You're switching the pin to DAC mode (if your MCU has a DAC) and driving it with an increasing value.

  2. The pin is disabled, and what you see is the drift of the voltage on the pin's and probe's combined capacitance.

  3. You're inadvertently switching the PWM to a very high frequency and the scope is set to too low sample rate. Make sure you set the scope to highest possible sample rate / sample depth / sampling length, and decrease the horizontal scale (i.e. decrease the time per division by 2x or 5x).