Skip to main content
Visitor II
June 10, 2025
Solved

No I2S output on a STM32G071 via TAS5722L

  • June 10, 2025
  • 4 replies
  • 948 views

I have a stm32g071gbu6 , that is linked to an I2S amplifier TAS5722L
PA5 (I2S_CK) -> BLCK
PA15 (I2S_WS) -> LRCLK
PB5 (I2S_MCLK) -> MCLK
PB6 (I2S_SD) -> SDI

I use a divider bridge to pass my 3,3V stm32 output to a 1,8V which is the only voltage the TAS accept.
I use a 10K and 12K ohm resistors to make my 1,8V.
I had a problem to control all the I2S output but the BLCK one. To try the outputs, I disabled the I2S and changed all the pin to normal Output. I was still not able to have any control of the outputs.
So I unsoldered resistor R28 on my MCLK output, and R32 on WS to be sure it didn't had any influence.
I'm still not able to have 3,3V on my MCLK output, nor my SD and CS.As I saw a patern that the non working outputs were only on the same side of the MCU, I tried 3 of the 4 other pins from this side, I tried the UART one, it appear that the PB3 does not work either, but PB6 and PB7 seems to work.
All the other pin that I could try seems to work fine.

I tried a new project, and I tried this on 2 different boards :

My program actually only toogle the outputs :

while (1)
{
	HAL_GPIO_TogglePin(Orange_LED_GPIO_Port, Orange_LED_Pin);

	HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); // I2S_CK_TEST (PA5)
	HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_15); // I2S_WS_TEST (PA15)

	HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_4);	// I2S_MCLK_TEST (PB4)
	HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_5); // I2S_SD_TEST (PB5)
	HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_3); // UART1_RTS (PB3)
	HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_6); // UART1_TX (PB6)
	HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_7); // UART1_RX (PB7)

	test_CK = HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_5); // I2S_CK_TEST (PA5)
	test_WS = HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_15); // I2S_WS_TEST (PA15)
	test_MCLK = HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_4); // I2S_MCLK_TEST (PB4)
	test_SD = HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_5); // I2S_SD_TEST (PB5)
	HAL_Delay(300);
}

I'm a little bit out of option to understand the problem, is it possible that I have a bad serie of STM32G071 ?

    This topic has been closed for replies.
    Best answer by Raphy

    I actually found the problem :
    My client didn't gave me a stm32g071gbu6, but a stm32g071gbu6n ...
    So now everything works as expected.
    Thanks for your help !

    4 replies

    RaphyAuthor
    Visitor II
    June 10, 2025

    I forgot to add the schematic

    Super User
    June 10, 2025

    Can you post a large in focus picture of the board?

    Are pins being set up in GPIO output mode? You don't show those registers. Does ODR toggle as expected when you stop through code? And IDR only toggles on some bits, which bits, show screenshots.

    > is it possible that I have a bad serie of STM32G071 ?

    unlikely.

     

    Resistor values are missing in schematic, and you've hidden what they're hooked up to, so it's hard to debug. If pins are driven externally you're not going to be able to toggle them.

    RaphyAuthor
    Visitor II
    June 10, 2025

    Thank you for your answer.
    I desoldered every restitor linked to this outputs from my board to make the debug easier.
    Now PB4, PB5, PB5, PA5, and PA15 are floating, configured as output, low speed, pushpull and no pullup/pulldown resistor. The very basic output configuration.
    ODR react perfectly at my command, I tried using ODR register and BSSR register as well. In both cases, ORD toggle also the way I want. I just dont have voltage on certain of my output pin, as IDR shows below. I also checked every pin that I could put as output, they are all working perfetcly fine but the one I said and also PB1 that have the same problem. In the picture and code below, I just show the main output that i'm interessed in, not all of them.
    So to resume :
    PB1, PB3, PB4, PB5, PB6 and PA15 are uncontrollable (ODR = 1, IDR = 0) as a basic output push pull no drain, pin not connected to anything.

    void MX_GPIO_Init(void)
    {
     GPIO_InitTypeDef GPIO_InitStruct = {0};
    
     /* GPIO Ports Clock Enable */
     __HAL_RCC_GPIOC_CLK_ENABLE();
     __HAL_RCC_GPIOA_CLK_ENABLE();
     __HAL_RCC_GPIOB_CLK_ENABLE();
    
     /*Configure GPIO pin Output Level */
     HAL_GPIO_WritePin(GPIOC, Red_LED_Pin|Orange_LED_Pin|Green_LED_Pin, GPIO_PIN_RESET);
    
     /*Configure GPIO pin Output Level */
     HAL_GPIO_WritePin(GPIOA, I2S_CK_Pin|I2S_WS_Pin, GPIO_PIN_RESET);
    
     /*Configure GPIO pin Output Level */
     HAL_GPIO_WritePin(GPIOB, USART1_RTS_Pin|I2S_MCLK_Pin|I2S_SD_Pin|USART1_TX_Pin
     |USART1_RX_Pin, GPIO_PIN_RESET);
    
     /*Configure GPIO pins : Red_LED_Pin Orange_LED_Pin Green_LED_Pin */
     GPIO_InitStruct.Pin = Red_LED_Pin|Orange_LED_Pin|Green_LED_Pin;
     GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
     GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
     HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
    
     /*Configure GPIO pin : PA2 */
     GPIO_InitStruct.Pin = GPIO_PIN_2;
     GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
    
     /*Configure GPIO pins : I2S_CK_Pin I2S_WS_Pin */
     GPIO_InitStruct.Pin = I2S_CK_Pin|I2S_WS_Pin;
     GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
     GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
    
     /*Configure GPIO pins : Switch_Pin Fault_amp_Pin */
     GPIO_InitStruct.Pin = Switch_Pin|Fault_amp_Pin;
     GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
     HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
    
     /*Configure GPIO pins : USART1_RTS_Pin I2S_MCLK_Pin I2S_SD_Pin USART1_TX_Pin
     USART1_RX_Pin */
     GPIO_InitStruct.Pin = USART1_RTS_Pin|I2S_MCLK_Pin|I2S_SD_Pin|USART1_TX_Pin
     |USART1_RX_Pin;
     GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
     GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
     HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
    }

     After_toogling_output.pngbefore_toogling_output.png

    RaphyAuthor
    Visitor II
    June 10, 2025

    I even manually put 3,3V on all the problematic GPIO to check if IDR would change.
    It does work for all the pins but the one that have a problem already, so it doesn't seems to be a configuration problem but a STM32 problem. I cannot provide a good big zoom on the STM32 soldering.
    I bought a nucleo board to compare the problematics

    RaphyAuthor
    Visitor II
    June 18, 2025

    Thanks for the answrer.
    We don't see any current rise of the current when I try to change the state of the outputs.
    We tried to measure the resistance/diode, and we cannot see any fun readings when we compare the outputs that have a problem and normal ones.
    We tried a 3rd microcontroller on a 3rd PCB (same design, but the pcb have been carefully reviewed. Only soldered on the PCB : the power supply, the 3,3V LDO and pin for the ST-Link).
    PB1 was set as an input on the example I gave you, but I tried with the output configuration and it does not work.

    RaphyAuthorAnswer
    Visitor II
    June 19, 2025

    I actually found the problem :
    My client didn't gave me a stm32g071gbu6, but a stm32g071gbu6n ...
    So now everything works as expected.
    Thanks for your help !