cancel
Showing results for 
Search instead for 
Did you mean: 

How can UART_Tx impact neighboring GPIO pins?

IGärt.1
Associate II

I have a STM32G071 where, among other stuff, an UART interface an a GPIO input are configured.

UART is mapped to PA9 - PA12 (Tx, Rx, CTS, RTS).

PA8 is configured as GPIO input mode (no pull-up, pull-down). On the net connected to PA8 is a hall sensor with open-drain output. This net has an external 10k pull-up resistor.

GPIO ports are initialized first, then UART.

When I stop the code after GPIO init, the hall sensor input works like a charm. The signal is 3 V when no magnetic field is present, and 0 V when the field is present. The GPIO input register show the correct value.

The moment I initialize UART, more specific, when the "transmitter enable" bit USART_CR1->TE the voltage at PA8 drops from 3 V to 1 V. When UART communication is started, the UART_Tx message is visible on the net of PA8. The blue signal is PA8 and the red signal is UART_Tx.

0693W00000FBmPVQA1.png 

The GPIO configuration of PA8 does not change while UART is configured. It still works as input. When I connect the net directly to 3 V, it shows a '1' in the GPIO input register.

Since PA8 goes to 1 V when UART_Tx is high, it is not a resistive coupling from the PCB (then the signals would be in phase).

Apart from the close proximity of the pins, UART_Tx is PA9, there is no connection between those pins. The two nets are only close to each other at the MCU.

The effect showed up on all three PCBs I looked at.

When I measure the resistance between PA8 and PA9 the multi-meter shows approx. 330 kOhms.

Can anybody help? Did anybody see this sort of behavior before?

1 ACCEPTED SOLUTION

Accepted Solutions

Oh it just downed on to me, this is the infamous USB-C dead battery support (the related internal pulldown is nominally 5k1, that exactly matches the 1V with 10kOhm pullup).

Upon reset, the UCPD CCx lines present a pull-down resistor that can be disabled by

setting the UCPDx_STROBE bit of the SYSCFG_CFGR1 register.

... and this pull-down resistor is switched by related UCPDx_DBCCx pin...

JW

View solution in original post

6 REPLIES 6
TDK
Guru

It shouldn't, unless there is a hardware connection somewhere. Do you have a nucleo board or other known good hardware to see if it has the same response?

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

> connected to PA8 is a hall sensor

What Hall sensor? Where is it physically placed? Where is UART Tx connected on the other side?

JW

IGärt.1
Associate II

Hello TDK. Unfortunately, I did not found my Nucleo of the STM32G071. One is ordered, I intent to test it on it as well. Therefore, I cannot answer that at the moment.

Hello Jan. The hall sensor is Diodes Inc. AH1815, It is about 1 cm right / beneath the MCU. The UART connector is about 4 cm above the MCU. So the two components are on the oposite side of the MCU. The only place where the two nets are close is at the MCU, where they are connected to the MCU on PA8 and PA9 (Pin #18 and #19).

The hall sensor seems not to be the problem. I disconnected it from the MCU (there was a 0R on the net to the MCU) and activated the pull-up of PA8. The effect is the same. I see the UART_Tx signal on PA8, though the DC voltage is now 0.36 V instead of 1 V

Oh it just downed on to me, this is the infamous USB-C dead battery support (the related internal pulldown is nominally 5k1, that exactly matches the 1V with 10kOhm pullup).

Upon reset, the UCPD CCx lines present a pull-down resistor that can be disabled by

setting the UCPDx_STROBE bit of the SYSCFG_CFGR1 register.

... and this pull-down resistor is switched by related UCPDx_DBCCx pin...

JW

JW is so smart.

What a weird design choice. Maybe it makes sense to do this. I don't use UCPD at all.

If you feel a post has answered your question, please click "Accept as Solution".
IGärt.1
Associate II

Hey Jan, thanks so much for your support! :thumbs_up:

The problem was solved by writing a '1' to the UCPDx_STROBE bits right before the general GPIO configuration.

It puzzles me, that this resistors are enable by default, even though USB-C is not enabled. But hey, I've learned something today, that's worth some of the trouble :grinning_face_with_sweat:

Cheers

\i