Waveform Generator (Two DAC examples)

Post your cool example code here.
Viktor_7
Posts: 1
Joined: Mon Aug 07, 2017 2:59 pm

Re: Waveform Generator (Two DAC examples)

Post by Viktor_7 » Tue Aug 08, 2017 8:10 am

Hello!
Please help, why does the ADC on STM32F103VCT6 work properly, and on STM32F100 (STM32VLDISCOVERY) does not work ??
In the board manager, I select the required microcontroller.

dannyf
Posts: 140
Joined: Wed May 11, 2016 4:29 pm

Re: Waveform Generator (Two DAC examples)

Post by dannyf » Sat Aug 19, 2017 1:21 pm

Sawtooth waveform on both DAC channels
code pieces like that are helpful in testing a concept but not that useful in real life, as the loop timing is generally not consistent from run to run.

a much better approach is DDS:

1) create waveform in tables;
2) index the tables via a phase accumulator;
3) in a timer isr, increase the phase accumulator and then output the waveform;

by changing the increments to phase accumulator, or the waveform tables, you can change the output frequency, or output waveform, easily.

DDS chips are essentially that, but implemented via hardware.

User avatar
RogerClark
Posts: 6894
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Waveform Generator (Two DAC examples)

Post by RogerClark » Sat Aug 19, 2017 9:18 pm

You could use DMA to take data from the table and send to the DAC, as this would remove the overhead of the ISR.

I think the setup would be similar to what @stsvstrong has written to use DMA to read from an 8 bit parallel GPIO device ( the OV7670 camera).
You would just need to change the direction of the DMA and the port address

ag123
Posts: 740
Joined: Thu Jul 21, 2016 4:24 pm

Re: Waveform Generator (Two DAC examples)

Post by ag123 » Tue Sep 19, 2017 4:36 pm

this is itching me to try out the DAC on the stm32f407vet6 black boards :lol:

Post Reply