2018-08-20 08:21 AM
When I write the value in loop
eg. VALUE_to_WRITE = 1000;
for(int i =0; i < VALUE_to_WRITE; i++){
HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_12B_L, value);
HAL_DELAY(4);}//no less than this
The value is written. But it const me 5-10 seconds when I want to write value?
Any help will be appreciated
2018-08-20 08:31 AM
What STM32? There are like hundreds of parts over dozens of families, Be Specific!
Defining the board, or describing the circuit would also be helpful.
Not sure why it would delay for 5-10 seconds unless you're got some very odd clocks and timing loops.
Most STM32 DAC will sustain 1 MHz (1 us) update rates, check the Data Sheet.
If driving into a capacitive load consider using a buffer/opamp.
2018-08-20 09:47 PM
I'm using Stm32 - F303CCTx. I'm taking the direct DAC output and feeding it to the multiplier circuit which changes the output voltage range from 0-3.3V to 0-9.9V. I'm already using the opamp. I'm not any delays in this. Even teh basic code which is driving the DAC from 0 - 4095(12 bit right align) needs this delay. I have no idea why.
2018-08-20 10:33 PM
[quote]The value is written. But it const me 5-10 seconds when I want to write value?[/quote]
Then you are doing something wrong.
As Clive says, you can update the DAC data register with 1 MHz, but the DAC itself has a settling time of about 2...5ms.
Perhaps you have an hardware issue, and your buffer opamp is inappropriate. Do you have the internal buffer enabled ? Else, the DAC has more than 1 Mega Ohm impedance.