cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_SAI_Transmit() 32 bits audio, STM32H747-DISCI

ALevc.1
Associate III

Hello,

I use HAL_SAI_Transmit() to play wav file from external flash. Music sounds correct when the wav file is 16 bits audio but there is a lot of noise when I play 32 bits audio.

I have of course checked 10 times that the bytes order and the samples are ok. BSP_AUDIO_OUT_Init() is used to configure the audio system for 16 or 32 bits

Any idea what could be wrong? Any hints, thoughts comments are really welcome!

Best Regards,

Anton

4 REPLIES 4

> Any idea what could be wrong?

BSP_AUDIO_OUT_Init() perhaps.

Read out and check relevant SAI, DMA/DMAMUX register content. Compare to the working case, considering the necessary differences.

You may want to generate some simple pattern (sawtooth) into RAM and play back that, observing the output on oscilloscope, to isolate any possible issues with the external flash (what exactly is that?)

JW

ALevc.1
Associate III

Hi JW

Tank you for the hints. The external flash is two 512-Mbit Quad-SPI Flash memory devices (MT25QL512ABB8ESF-0SIT from MICRON). I really think that the external flash is not a problem. I can trace that the samples are as they should be and if I copy samples first to the local buffer, and then send the samples from the buffer the sound is the same.

I also use HAL_SAI_Transmit() what is blocking transmit so no DMA or interrupts are used in this case.

I guess I have to dig down into SAI, I hoped that BSP and HAL routines will just work so could stay on this high level....

BR Anton

Piranha
Chief II

And what about 24 bits? I hope you do understand that 32 bit modes for SAI and ADC/DAC exist only for a technical convenience, not audio resolution. That's why SAI can be configured to 32-bit slot size with 24-bit data size. Of course you still need to feed the SAI with 32-bit words, but storing 32 bits is a waste of space. 🙂

Didn't try 24 bits yet. Yes, you are right. WM8994 codec has 24-bits 4-channel DAC so there won't be any difference between 32 bits and 24 bits audio. I use 32 bits due to application specific reasons. Anyway, so far I convert it to 16 bits and play but would be nice to play the audio without conversion.