cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F42X - TIMER + DAC + DMA: SINE WAVE

ennioaloisini
Associate II
Posted on March 19, 2014 at 19:43

Dear All,

I would like to create a 1.5 MHz Sine Wave using TIMER + DAC + DMA.

I have started from the DAC_SignalsGeneration example for Discovery board and then I have modified the TIM_TimeBaseStructure.TIM_Period  from 0xFF to 1.

I have done the measurement with the oscilloscope and in the first case (Period = 0xFF) the sine wave has a frequency of 11kHz and in the second case (Period = 1) the sine wave has a frequency of 350kHz. Sincerly I thought to obtain an higher frequency because the period is 255 times lower. Could anyone explain this behaviour? 

Then I would like to know if it is possible to create a 1.5 MHz Sine Wave with Timer + DAC + DMA or if it is better to use a different solution.

Let me know!

Best regards
11 REPLIES 11
Posted on March 19, 2014 at 20:09

How many points are there in the wave table? This and your time base set up will directly impact the speed. The upper limit will be the bandwidth of the DMA operation, or the pin driver.

I think it's certainly possible to generate waves over 1-2 MHz, perhaps up to 10 MHz

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
frankmeyer9
Associate II
Posted on March 19, 2014 at 20:21

I would like to create a 1.5 MHz Sine Wave using TIMER + DAC + DMA.

 

In addition to clive's hints, you will definitely need to check the DAC output settling time specified in the datasheet.

I don't know the F42x part, but the DAC of other STM32 MCUs had times in the range of several microseconds, definitely not capable of >= 1MHz output.

ennioaloisini
Associate II
Posted on March 20, 2014 at 11:06

Dear All,

the Sine Wave has 32 points.

Regarding the DAC output settings I have searched on the STM32F42X datasheet, but I have not found this information.

Where can I find this information?

Let me know!

Best regards

chen
Associate II
Posted on March 20, 2014 at 12:06

Hi

''the Sine Wave has 32 points.

Regarding the DAC output settings I have searched on the STM32F42X datasheet, but I have not found this information.

Where can I find this information?''

You are not understanding what fm is telling you.

''In addition to clive's hints, you will definitely need to check the DAC output settling time specified in the datasheet.''

Look at the DATASHEET  (not the reference manual) :

In section ''DAC electrical characteristics''

In the table : look for ''tSETTLING'' and ''Update rate''

The 'update rate' tells you the maximum rate of change (small steps) the DAC is capable of (ie the max frequence it can generate)

The 'tSETTLING' tells you the time the DAC output needs to go to the final voltage if it does a large voltage jump. This can also limit the maximum frequency the DAC can generate.

frankmeyer9
Associate II
Posted on March 20, 2014 at 12:25

Where can I find this information?

 

For the STM32F27x/F29x, it is page 160 ofthe datasheet (DM00071990.pdf):

0690X000006051dQAA.png

I wouldn't expect better data for other F4xx parts...

chen
Associate II
Posted on March 20, 2014 at 13:04

Hi fm

We are using the STM32405 for the project where I work.

It has the same spec for the DAC as you pasted (by the way how do I paste pictures? )

I just looked up the STM32F427x/STM32F429xx data sheet.

Surprise, surprise - it is the same.

http://www.st.com/web/en/resource/technical/document/datasheet/DM00071990.pdf

frankmeyer9
Associate II
Posted on March 20, 2014 at 14:14

I just looked up the STM32F427x/STM32F429xx data sheet.

 

Surprise, surprise - it is the same.

 

As I found out last year, ST even Copy-&-Past's peripheral components between STM8 and STM32 parts. It makes sense IMHO.

It has the same spec for the DAC as you pasted (by the way how do I paste pictures? )

 

It involves the ''Picture manager'' in the menu, but you need to upload the image in the process. The image itself was prepared with a screenshot tool before.

And BTW, the forum software crashed me again at the first try ...

... and again during this post (shame on ST !)

ennioaloisini
Associate II
Posted on March 21, 2014 at 01:01

Dear All,

I have checked the datasheet and the STM32F427XX / STM32F429XX have the same values. How could I create a 1.5MHz Sine Wave? Using PWM?

Let me know!

Best regards

Posted on March 21, 2014 at 02:32

darth.vader created a VGA Video DAC using a resistor ladder implementation.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..