cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G070KB PA8 and PA9 interaction

Trilys
Associate II

Hello,

We have run into a weird behaviour with the STM32G070KB. With PA8 defined as an input with internal pullup and PA9 as output push-pull.

When PA9 is at low level and PA8 unconnected, PA8 is at VCC (3.3V) as expected.

When PA9 is at high level, PA8 drops to 0.29V. Adding an external 10k pull up raises PA8 to around 1V.

Actually after more tests, leaving PA9 as an input and driving it externally to VCC also makes PA8 to drop.

We are using a custom board, but at this point after unsoldering components and cutting traces, both PA8 and PA9 are not connected to anything so this is not due to external components.

This code sample reproduces the behaviour :

int main(void)
{
	SET_BIT(RCC->IOPENR, RCC_IOPENR_GPIOAEN);
	//Set PA8 as input pull up
	GPIOA->MODER &= ~GPIO_MODER_MODE8;
	GPIOA->PUPDR |= GPIO_PUPDR_PUPD8_0;
	//PA8 reads 3.3V as it should
 
	//Set PA9 as output push-pull low
	GPIOA->MODER &= ~GPIO_MODER_MODE9_1;
	GPIOA->OTYPER &= ~GPIO_OTYPER_OT9;
	GPIOA->BSRR = GPIO_BSRR_BS9;
	//PA8 reads 0.29V at this point
 
 
    while (1)
    {
 
    }
 
    return 0;
}

Why is this happening ? How can we avoid it ?

Best regards,

Geofrey MARCEL

10 REPLIES 10
KPeso.1
Associate II

Hi all,

Where did you add the line: SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_UCPD1_STROBE)? I have added it before and after GPIO init, but it seems not to disable the pulldown on PA8 pin on my G070KB (32pin). I have PA9 configured as UART_TX. Is there something else needed to set/reset in the registers to get this worked around?