Yes, maybe I'll try to know how it works. I'd like to try some audio DSP using the same board + ADC. But it does look complicated from DMA-noob point of view. I can find a lot of examples for the HAL library but not much with STM32duino. I got your example I need to go through it few times.

thanks for the reply. Below is a mess, but all Im trying to do it get your example to compile and play. im using the arduino IDE. This will now compile with the variable declare and #include statements I added. i have an uncompressed 8bit, 8khz, mono, wav called song0002.wav on the sd card. on spi 1. simple speaker on PA8 (TIM1_CH1). Im trying to get that wav to play.

thanks for the help. im just getting started with this device and I'm a little lost because of how this great information is spread out in this forum.

I was thinking that the example nicolas posted was related to the TMRpcm library that Victor has been working on porting. I believe now I understand that the example is using an External DAC. so basically the main loop() is responsible for refilling each 512 byte dual buffers, while the interrupt send out 2 8-bit PCM data (using SPI_2.transfer) to the PT8211 DAC. This is done at a rate that is proportional to the sample rate of the WAV file from the file header info.

The information is spread all out in the forum. But it seams like Victor has written a DMA function in the most recent TMRpcm lib update. This function could be extracted from the TMRpcm.cpp and used in the example nicolas posted?

I trying to the understand the data signal flow from Wav file to the DAC with and without DMA. Does both the PT8211 and the SD card use DMA? or somehow the PT8211 uses i2s and the sd card uses DMA? or just do DMA on SD card and SPI_2.(transfer); to the DAC?

It seems like this version does neither i2s or dma. the flipflop buffer read is just interrupted on each TIM2 interrupt. if this is true then it seems that there could be significant performance increase if DMA or I2s were used.

My program is not relying on TMRpcm. It is simply reading a wave file from the sd card and sending the bytes to the pt8211.
The program is made for 16bits 44.1khz files. You would need to modify it to make play back 8 bits 8khz files.

Maybe at first forget about DMA, you really don't need it, especially for 8khz files.