Hi,
I'm trying to write DAC value on Stm32, but I'm unable to do so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-08-20 8: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
- Labels:
-
DAC
-
STM32Cube MCU Packages
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-08-20 8: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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-08-20 9: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
