cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, Can anybody tell me how to generate sine waveform using STM32F334R8T6 MCU? It has 3 channels (12 bits) DAC.

sagar
Associate II

I am using STM32CubeMX to generate source code and Keil 5 for compiling the code.

Please help.

Thanks & Regards.

Sagar.

11 REPLIES 11
AvaTar
Lead

Create a sine value table, and push it out periodically.

Hey Thanks, I got the output.

Now, when I am generating sinewave triggered at 50% (90 degree and 270 degree) I am not getting precise voltage levels at zero level.

Please guide me.

thanks

Sagar.

sagar
Associate II

At zero level some offset voltage gets added (Vmax & Vmin). How to minimize it to zero?

I am using STM32F334R8T6 based STM32F3 Series board by configuring DAC1 of it.

There will always be offset in the DAC. Refer to the datasheet to see how much.

This does not look like a sine at all.

AvaTar
Lead

The DAC outputs voltages from 0V to Vref (usually 3.3V). There can't be negative voltages on the DAC.

With the output buffer enabled, the the offset of max. 200mV limits the output span.

I use to leave that buffer off, and have an external buffer amplifier instead.

I hope you have an idea on how to create a sine table, and output it continuously to the DAC.

Outputting a sine table to the DAC provides a fixed frequency. To variate the frequency you can use a NCO.

https://en.wikipedia.org/wiki/Numerically_controlled_oscillator

Yes Jeroen3, I want to generate signal like thyristor output at different % values.

As arrow in image shows,

for 0 to 90 my waveform shifted upwords

for 90 to 180 getting values from lookup table of sine wave.

for 180 to 270 my waveform shifted downwords

for 270 to 360 getting values from lookup table of sine wave.

Thank you..