2016-07-12 07:26 AM
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 sineWhen 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) ?2016-07-12 09:03 AM
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 KHz2016-07-13 05:57 AM
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?
2016-07-13 07:46 AM
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.2016-07-13 08:24 AM
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?