Skip to main content
Visitor II
February 1, 2024
Question

STM32F405 + tlv320aic3204 - Audio Driver

  • February 1, 2024
  • 2 replies
  • 2820 views

Hi everyone, I hope someone can help me find or create a driver to communicate the tlv320aic3204 with the stm32f405 on my own custom board. 

I have been trying to replicate this tutorial (STM32 I2S ADC DMA & Double Buffering - Digital Audio Processing with STM32 #4) but I have not been successful. Some parts of the audio driver are not shown, and my experience with i2s is very low.

All my code compiles and everything seems to be ok, however I noticed that apparently it's as if my stm had crashed, because I put a blink on my leds to happen in the while but they don't blink, but if I comment the function that configures the i2c and the i2s, then blink works.

 

I saw other posts that there were people here who managed to communicate this mcu with the codec, I wonder if anyone has released this project or would like to help me with this mission :grinning_face_with_sweat:

    This topic has been closed for replies.

    2 replies

    Visitor II
    February 1, 2024

    i2c boot code: 

    hi2c2.Instance = I2C2;
    hi2c2.Init.ClockSpeed = 100000;
    hi2c2.Init.DutyCycle = I2C_DUTYCYCLE_2;
    hi2c2.Init.OwnAddress1 = 0;
    hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
    hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
    hi2c2.Init.OwnAddress2 = 0;
    hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
    hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
    if (HAL_I2C_Init(&hi2c2) != HAL_OK)
    {
    Error_Handler();
    }


    i2s boot code: 
    /* USER CODE END I2S2_Init 1 */
    hi2s2.Instance = SPI2;
    hi2s2.Init.Mode = I2S_MODE_MASTER_TX;
    hi2s2.Init.Standard = I2S_STANDARD_PHILIPS;
    hi2s2.Init.DataFormat = I2S_DATAFORMAT_16B;
    hi2s2.Init.MCLKOutput = I2S_MCLKOUTPUT_ENABLE;
    hi2s2.Init.AudioFreq = I2S_AUDIOFREQ_48K;
    hi2s2.Init.CPOL = I2S_CPOL_LOW;
    hi2s2.Init.ClockSource = I2S_CLOCK_PLL;
    hi2s2.Init.FullDuplexMode = I2S_FULLDUPLEXMODE_ENABLE;
    if (HAL_I2S_Init(&hi2s2) != HAL_OK)
    {
    Error_Handler();
    }
    /* USER CODE BEGIN I2S2_Init 2 */

    Visitor II
    April 26, 2025

    Hi, Frotaitalos

    I have faced the issue on similar projects in the past time.

    I hope you have completed the full logic to communicate the TLV chip with the stm32f405 for your personal hardware.

    I wanna share my experience and opinion in this region.

    If you are still interested, please let me know.

    Thanks.

    Explorer
    May 9, 2025

    Hi @frotaitalos @PeterYan, I am trying to do the same thing and having trouble finding resources online on how to get audio playing using the STM32 SAI and I2C. Any tips or anywhere you can point me?

     

    Thanks!

    Visitor II
    May 9, 2025

    Hi Lucas,

    I managed to get everything working, please email me at frotaitalos@gmail.com