cancel
Showing results for 
Search instead for 
Did you mean: 

I2S Basics

Cyril Yang
Associate
Posted on July 05, 2018 at 18:03

Hi everyone,

I'm looking for some help after many days of pain.

I'm trying to write basic uSD to I2S application, but the result is really ugly.

I'm using STM3240G eval board and Adafruit MAX98357 board.

I'm using fatfs and sdio to read a wave file on my uSD card.

I'm filling 2 or 3 buffers and sending data through I2S at the same time.

I've configured the I2S DMA as following : 

Mode Circular, Data Width : Half Word, Burst Size : Single.

My I2S is configured as following :

Mode Master Transmit

MSB First

16 bits data on 32 bits frame

48 KHz

Clock Polarity Low

So first, i initilialize the fat file system and read the audio file. I then extrac the header before filling my uint16_t buffers.

Then, i use 'HAL_I2S_Transmit_DMA' to send the data from my buffer to I2S.

The 'HAL_I2S_TxCpltCallback' is then used to change the buffer sent and the buffer to fill.

So, each time a transfert is complete, i send the next buffer through I2S DMA, and refill the last buffer .

When i check the buffers in debug mode, they seem good. Clocks are good too.

I can hear some parts of the music played but it is really not listenable.

I've imported some audio file into Audacity and exported them into signed 16 bits PCM wave files.

Can you please help me or guide me on how i should configure my system ?

It's driving me crazy ! ><

Thank you very much !

Project's folder is attached.

1 REPLY 1

For commercial projects contact local sales/support office and discuss with an FAE

Attachment lost in forum migration

No activity >1month

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..