cancel
Showing results for 
Search instead for 
Did you mean: 

How to control the I2S and I2C for the CS43L22 DAC?

BobWalance
Associate III

In STM32CubeIDE, there doesn't seem to be any way to access the I2S and I2C interfaces for the CS43L22 on the STM32F407G-DISC1 board. There is nothing in the System Core, Analog, Timers ... Middleware and Software Packages configuration area of CubeIDE.

I will be generating my own audio samples, and they will be sent to the DAC in a timer interrupt. I will not be using DMA.

I have gathered numerous files that perform the higher-layer functions necessary, but I cannot find anything related to the low-level hardware control. For example, the schematic for the board indicates that the I2C address for the codec is 0x94. When I search through all of the files that I have found for "94", I don't find anything related to this address and I2C.

There must something out there because many people are successfully accessing this codec. I just cannot find it.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Look at the Audio_playback_and_record example in the Cube repo.

Low-level driver for CS43L22 starts here:

https://github.com/STMicroelectronics/STM32CubeF4/blob/d5af56388ff037735ac99de39abf2b46f9921aa3/Drivers/BSP/STM32F4-Discovery/stm32f4_discovery_audio.c#L249

> When I search through all of the files that I have found for "94", I don't find anything related to this address and I2C.

Here's where it's defined in the BSP files:

https://github.com/STMicroelectronics/STM32CubeF4/blob/d5af56388ff037735ac99de39abf2b46f9921aa3/Drivers/BSP/STM32F4-Discovery/stm32f4_discovery.h#L230

 

CubeMX isn't going to have a selection for CS43L22 explicitly. Rather, you would need to initialize the relevant I2C and I2S interfaces and use them according to the datasheet for the chip you're interfacing with.

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

View solution in original post

2 REPLIES 2
TDK
Guru

Look at the Audio_playback_and_record example in the Cube repo.

Low-level driver for CS43L22 starts here:

https://github.com/STMicroelectronics/STM32CubeF4/blob/d5af56388ff037735ac99de39abf2b46f9921aa3/Drivers/BSP/STM32F4-Discovery/stm32f4_discovery_audio.c#L249

> When I search through all of the files that I have found for "94", I don't find anything related to this address and I2C.

Here's where it's defined in the BSP files:

https://github.com/STMicroelectronics/STM32CubeF4/blob/d5af56388ff037735ac99de39abf2b46f9921aa3/Drivers/BSP/STM32F4-Discovery/stm32f4_discovery.h#L230

 

CubeMX isn't going to have a selection for CS43L22 explicitly. Rather, you would need to initialize the relevant I2C and I2S interfaces and use them according to the datasheet for the chip you're interfacing with.

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

Thank you very much! This contains the code that I need to complete my project.

The files, as they are, are proving to be very tricky to 'build' in the CubeIDE because there are several other files that are necessary, and there are some include directives in two of the header files that need modification. There's also a file called 'pdm2pcm.glo' that I'm having trouble finding. However, I don't need most of the stuff in these files - just need to get the I2C DAC registers configured and be able to send audio samples into the I2S. I'm confident that I can tear the code apart and make it work.