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: 167
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: 7443
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: 798
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:

escarneiro
Posts: 8
Joined: Sun Apr 16, 2017 9:17 pm

Re: Waveform Generator (Two DAC examples)

Post by escarneiro » Fri Oct 20, 2017 1:11 am

Guys,

I've been trying to make a blue pill works with a TDA1543, using the code from vassilis (viewtopic.php?f=18&t=519)
I'm wiring it in conjunction with a NE5532 , as the image below suggests:

Image

Well, I got nothing but noise on the TDA1543 outputs. Looking the output on PA5 (clock) on oscilloscope, I got this:
pic_18_1.jpg
pic_18_1.jpg (100.7 KiB) Viewed 215 times

Which I think is not even close to a decent clock signal.
Do you guys think my blue pill is defective ?

Another question: Is it possible to use another pin as clock, and/or to use another SPI to accomplish this task ?

PS: I cant find some PT8211 to buy. I only found it in SMD-mount format.

ChrisMicro
Posts: 308
Joined: Fri Mar 24, 2017 4:51 pm
Location: Germany

Re: Waveform Generator (Two DAC examples)

Post by ChrisMicro » Fri Oct 20, 2017 4:40 am

Do you really need a DAC or might be PWM or sigma delta pin toggling sufficient?

https://github.com/ChrisMicro/BluePillSound

stevestrong
Posts: 1813
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Waveform Generator (Two DAC examples)

Post by stevestrong » Fri Oct 20, 2017 9:41 am

escarneiro wrote:
Fri Oct 20, 2017 1:11 am
I've been trying to make a blue pill works with a TDA1543, using the code from vassilis (viewtopic.php?f=18&t=519)
I cannot find any specific code under the given link.

What is the scope of the presented circuit and how should it work?
What kind of signals are input to BCK, WS and DATA? Do you have any scope plots for those?

escarneiro
Posts: 8
Joined: Sun Apr 16, 2017 9:17 pm

Re: Waveform Generator (Two DAC examples)

Post by escarneiro » Sat Oct 21, 2017 12:08 am

stevestrong wrote:
Fri Oct 20, 2017 9:41 am
I cannot find any specific code under the given link.

What is the scope of the presented circuit and how should it work?
What kind of signals are input to BCK, WS and DATA? Do you have any scope plots for those?
Well, this is the code. https://pastebin.com/tSBUc42b
And that plot I've posted is from the BCK signal. Anyway, besides of it's strange shape, I took a look at it again and saw something even stranger (running now at half frequency / setting SPI divider at 32).

The BCK clock, alone (it is not contiguous!)
pic_24_1.jpg
pic_24_1.jpg (111.06 KiB) Viewed 183 times
BCK + WS (seems to be straigth)
pic_24_4.jpg
pic_24_4.jpg (136.47 KiB) Viewed 183 times
BCK + DATA (seems ok too)
pic_24_5.jpg
pic_24_5.jpg (124.44 KiB) Viewed 183 times












/** **/

escarneiro
Posts: 8
Joined: Sun Apr 16, 2017 9:17 pm

Re: Waveform Generator (Two DAC examples)

Post by escarneiro » Sat Oct 21, 2017 12:13 am

ChrisMicro wrote:
Fri Oct 20, 2017 4:40 am
Do you really need a DAC or might be PWM or sigma delta pin toggling sufficient?

https://github.com/ChrisMicro/BluePillSound
Yes, I want a DAC, but your project seems interesting too. But perhaps I couldn't understand the scheme you made. :lol:
It would be nice to have it designed in a EDA software

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Waveform Generator (Two DAC examples)

Post by Pito » Sat Oct 21, 2017 8:46 am

Potential issues:
1. your opamps may require +5V and -5V supplies (or higher as it is not an rail-rail opamp),
2. TDA is 5V and its input signals are 0-3.3V only,
3. the protocol is I2S, BP does not have that, afaik.
Pukao Hats Cleaning Services Ltd.

Post Reply