cancel
Showing results for 
Search instead for 
Did you mean: 

External DAC with SPI + DMA

decalvus
Associate II

Hi

I am trying to make an analog synthesizer, and for this is using a STM32G431 with some 8-channel DAC’s (connected via SPI) for generating control-voltages for the VCA’s and other circuits.

I would like to use the SPI with DMA, and have looked at the RM chapters, understood some of it, but feel I need some working code example to lean against to move forward.
When looking I only have found examples using either the internal DAC + DMA (without SPI), or SPI DAC but without DMA.
The F4 Discovery boards (e.g STM32F407G-DISC1) does have an audio playback & recorder example using a CS32L22 stereo codec with I2S and DMA, but uses I2C instead of SPI for sending initialization settings to the codec.

F4 or F3 examples could also be useful. I mostly chose G4 since it’s newer than F4, and hopefully some DMA and SPI quirks have been corrected in the new silicon (I may be naive though). At least it seems the errata mentions fewer ‘specialties’.

Anything using an external DAC (no matter which) with SPI+DMA or I2S+DMA will be very helpful. If some has a link to an example, or would share a piece of such code, it will be much appreciated.

Thanks

13 REPLIES 13

ok - close.... 

but H563 has 2x SAI :

AScha3_0-1694961071580.png

and each can drive 2 x IS lines, at max. 16 slot (channels) with 32bit , P 2448 :

AScha3_1-1694961278898.png

like this:

AScha3_2-1694961574785.png

AScha3_3-1694961715995.png

 

If you feel a post has answered your question, please click "Accept as Solution".

I feel like talking to chatAI bot. 

would you like to describe your feelings in more detail ?

If you feel a post has answered your question, please click "Accept as Solution".

Thanks for the suggestions. Will have to look for something more powerful than STM32

Although I don’t need 48kHz sample rate, like in a music player application. Something between 10 – 20kHz will probably be fine, but needs listening to the analog circuits before deciding.

The Moog One synth uses an XMOS for controlling 8 PCM1681’s (per 2 voices), i.e. 32 DAC channels per voice. It’s 8 core xCORE-200 XL series with 1000 MIPS
Sequential Prophet 6 and others use an FPGA (Xilinx Spartan 6 or Lattice ICE40LP). I have used FPGA’s previously so will probably go that way.