cancel
Showing results for 
Search instead for 
Did you mean: 

Sinewave amplitude on DAC supposed to be 3.3V, only reaches 2.64V

antoine
Associate II
Posted on July 12, 2016 at 16:26

Hi,

I have a code that generates a sinewave by reading an array and putting it in the DAC, and it works pretty well, except for one detail: the amplitude I read on the oscillo is 2.64V, but won't go any higher.

The array has the value 4095 in it, which corresponds to an output of 3.3V.

I checked the DOR register (Data Output Register), and it does read the value 0x0FFF.

I divided all the values by 2, and the amplitude went to 1.32V, so it's proportional.

I usually use this function with:

- 32 samples

- 960 kHz timebase, for a 30 kHz sine

When I use a much lower frequency (3 kHz sine frequency), I have 3.16V as amplitude, but it is too low for what I want to do.

The DAC update rate is 1 Msps, and I'm pretty sure I meet the other requirements.

Essentially, how is it possible to lose informations between the DOR and the analog conversion (0x0FFF in the DOR, but not on the oscillo) ?
4 REPLIES 4
Posted on July 12, 2016 at 18:03

On the DISCO, which has a 3.0V supply

 6KHz 2.94-3.00 Vpp

10KHz 2.80-2.82 Vpp

30KHz 2.84-2.88 Vpp

You'd probably want to review the slew-rate, or settling time, which looks to be closer to 333 KHz

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
antoine
Associate II
Posted on July 13, 2016 at 14:57

I see this parameter in the datasheet, how does it act in this matter?

I used the code you gave me to set the timer, but I thought as long as the frequency wasn't higher than the max update rate it was ok:

Period = (SystemCoreClock / 960000); 
// 960 KHz timebase, 30 KHz Sine
/* Time base configuration */
TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
TIM_TimeBaseStructure.TIM_Period = Period - 1;
TIM_TimeBaseStructure.TIM_Prescaler = 0;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM6, &TIM_TimeBaseStructure);

Also, I'm not sure anymore it has to do with the DAC, because now I use my oscillo as a sine generator (it can do that), and I test it, of course, on itself. Same values (3.3V and 30 kHz) and I have again 2.64V. Isn't it weird? Or it's just that the function generator's DAC has the same properties than regular boards?
Posted on July 13, 2016 at 16:46

It is a function of how quickly it can change, that depends on a) how aggressively it is driven, and b) what load it is driving. If it gets too aggressive you end up with overshoot, ringing, etc.

To evaluate the specification numbers, I would suggest you drive a 0, 4095 pattern into the DAC and see how it behaves at 1MSps, 200KSps and 100KSps. Look at the peak-to-peak voltage, and the slope of the signal.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
antoine
Associate II
Posted on July 13, 2016 at 17:24

By 0, 4095 pattern, you mean a square signal? And, to be sure, do I set the values (1 Msps...) in the code section I quoted? If not, where?