2025-06-10 4:38 AM - last edited on 2025-06-10 4:57 AM by Andrew Neil
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 ?
2025-06-10 4:53 AM
2025-06-10 6:14 AM - edited 2025-06-10 6:14 AM
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.
2025-06-10 8:05 AM
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);
}
2025-06-10 8:28 AM
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
2025-06-10 8:39 AM - edited 2025-06-10 8:40 AM
> 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.
PB1 is set to input mode, but the others should work.
Can you measure the overall current consumption? Does it go up when you try to output those high? If so, probably a short on the board.
The chip could also have been damaged.
2025-06-10 10:41 AM
If the pins are now disconnected from everything else, measure resistance or diode drop between them and ground and vdd using a multimeter and compare those to working pins when power is off. If the ESD diodes are shot due to overvoltage, they will provide dramatically different readings.