2023-01-20 05:49 AM
2023-01-20 06:22 AM
I do not know about your code, but something else is wrong based on the oscilloscope view.
When the PWM is not happening the sine wave looks good.
When the PWM is working the sine is not as high. Which is what I would expect from PWM, reducing the amplitude based on the percentage on when compared to the time of the off and on cycle.
It looks like you are starting with a sine wave and trying to modify it.
Normally someone starts with a constant voltage and uses PWM to make it look like a sine wave with a non-zero crossing.
2023-01-20 06:26 AM
Let me take a wild guess. The sine wave is 60 Hz? Or 50 Hz in Europe?
And you did not ground the probe it is floating?
Or the line is floating? If the line is floating, put a 100K to 1M resistor to ground on the circuit connected to the blue probe.
2023-01-21 02:35 AM
You should do do 16-bit to 16-bit transfers - set memory data size to 16 b and prepare 16-bit data in memory.
2023-01-21 11:45 PM
The lack of precising which STM32 we are talking about, answers maybe a miss.
Use a table cyclic looped by the DMA which feeds the Timer output compare.
This way, you can test the output waveform with zero interrupt, if your STM32 can do this.
Otherwise, if there is a DAC on the chip....