Skip to main content
AA.21
Associate III
March 10, 2023
Question

Hearing the voices not clear when i transmit the signal via I2S in the STM32WLE5JC

  • March 10, 2023
  • 13 replies
  • 8780 views

I used STM32WLE5JC control for playing the song via I2S. I have used SPI2 (alternat function of I2S) in the STM32WLE5JC. I can read the song in SD card and transmit the signal to the I2S in the I2S module (MAX98357A). The signal is transmitted to the I2S module and speaker ready to play. But I set the I2S exact hearable frequency(44.1khz) in the I2S initialization, that time noise is produced by the speaker. When I set the 8khz,11.025khz the song played slowly in the speaker. I am using MAX98357A mentioned frequency in the STM32WLE5JC, but no result.

I have attached the system clock & I2S configuration:

0693W00000aIgNCQA0.png0693W00000aIgNvQAK.png 

This topic has been closed for replies.

13 replies

LCE
Principal II
March 10, 2023

"Hearing the voices not clear" - what does that mean?

Do you hear the song, but noisy or distorted?

Are you sure the data from SD card has the correct format and endianness?

Maybe you're playing the LSB as MSB.

And check if you can setup all data transfers via DMA (I don't know that STM32):

SD -> DMA -> SRAM -> DMA -> I2S

or maybe even directly SD -> DMA -> I2S

AScha.3
Super User
March 10, 2023

when 44k making problems and slower data 11k not, you have a speed problem.

how you get the data to the i2S ? DMA?

btw i made a player, from SDcard to I2S -> DAC , with stm32F411 ; can play wav, MP3 and flac files. :)

If you feel a post has answered your question, please click on " Best Answer ".
AA.21
AA.21Author
Associate III
March 10, 2023

@Community member​ 

Do you hear the song, but noisy or distorted?

No, I can be able to hear some sound. But I couldn't identify whether the playing song is correct or not.

Are you sure the data from SD card has the correct format and endianness?

I have verified the same wav file formats song in ESP32 using I2S library.

How could I verify whether the LSB or MSB transmit first?

I didn't use DMA method for I2S data transmission. I am using interrupt method for I2S transmission.

@AScha.3​ For your information too.

@AScha.3​  btw i made a player, from SDcard to I2S -> DAC , with stm32F411 ; can play wav, MP3 and flac files

could you share any GitHub reference for our development.

I had gone through many web sites, and I got some references. While i trying to compile same code, it was showing multiple errors.

So, kindly share some reference, if you know.

AScha.3
Super User
March 10, 2023
AA.21
AA.21Author
Associate III
March 11, 2023

@Community member​ @AScha.3​ 

I gone through the you shared GitHub linkes. But I didn't understood. 

Kindly share some reference or documents of I2S protocol is integration to the stm32wl series .

 Also share the I2S protocol CLOCK reference.

I read the i2s protocol in many websites. But proper explanation and No clock details on websites.

Practical i changed the PWR_REGULATOR_VOLTAGE_SCALE (AHB, APB1 frequency 16Mhz,64Mhz) song frequency in 8khz,11.025Khz,16khz,22.050khz, 32.khz,44.1khz and 48khz. I can be able to hear some sound. But I couldn't identify whether the playing song is correct or not.

I think i mistaked in the system and I2S clocks. So kindly share the reference for the Clock.

How could I verify whether the LSB or MSB transmit first?

Piranha
Principal III
March 11, 2023

Are you capable of finding a door in a room?

https://en.wikipedia.org/wiki/I%C2%B2S

https://www.nxp.com/docs/en/user-manual/UM11732.pdf

> How could I verify whether the LSB or MSB transmit first?

By reading the reference manual!

LCE
Principal II
March 13, 2023

> How could I verify whether the LSB or MSB transmit first?

You could write a wav-file for SD card that contains audio samples like 0x00FF or 0xFF00 and check sdata with scope.

And yes, read the manual and try to understand, compare source code and register settings.

AA.21
AA.21Author
Associate III
March 13, 2023

@LCE

I have used I2S in Interrupt method. I have used 16bit array (size - 4096) and stored the SD card read data. every I2S transmit the 4096 of data to send the I2S Module (MAX98357A).

Which method should I use for I2S data transfer? Interrupt or DMA.

AScha.3
Super User
March 13, 2023

>3 days ago

you have to use circular DMA for player .

If you feel a post has answered your question, please click on " Best Answer ".
AA.21
AA.21Author
Associate III
March 17, 2023

@AScha.3​ @Community member​ 

Hi,

I have tried the DMA method also. It didn't play song in the speaker. But this time the song is played in 8khz,16khz,32khz, but the song speed is very slow.

 I put in the actual frequency 44.1khz in i2s communication that time noise produced in the speaker, and it couldn't hearable.

I read the STM32WL-RAK-3172 reference manual. In that manual list out the frequencies based on the I2S communication (PLL clock configurations). I tried to the set the PLL clock in cube IDE clock configuration, but I didn't able to set the PLLQ clock source. 

Forcefully I tried to set the PLLQ Clock, but the -warning is shown in the configuration.

If I enable the PLL CLOCK, that time I2S didn't worked. I can't see any output in the serial monitor, if enable the PLL clock.

0693W00000aJAxyQAG.png0693W00000aJB04QAG.pngSome warning is stated in that reference manual. I attached the warning massage screenshot below:

0693W00000aJB1vQAG.pngSo I changed the I2S clock same like in APB clocks.

0693W00000aJArIQAW.png​That time also the song didn't play in actual CD drive frequency 44.1khz.It only noise sound is produced in the speaker.

I also attached the DMA configuration below:

0693W00000aJB2yQAG.png

I have been working for a long time in the I2S protocol.

Kindly help solve this problem.