cancel
Showing results for 
Search instead for 
Did you mean: 

Why is it not possible to configure a UART interface in CubeMX without a pull-up on Tx line?

theo.brunner
Associate II

Hello everyone,

I have a system with two STM32F446 which are connected over the USART2 interface to be able to communicate with each other. One of the STM32F446 is powered with 3V3 and the other one with 3V.

I used CubeMX (version 5.3.0) to configure the USART mode as asynchronous. The GPIO's I would like to configure as alternate function push pull without any pull-up because of the different power levels. But in CubeMX I have to select a pull-up. Why I have to do this? How can I configure an asynchronus UART without pull-up on Tx line in CubeMX?

5 REPLIES 5
Piranha
Chief II

Because that's the status quo and monkeys writing code are not bothered with thinking!

> alternate function push pull without any pull-up because of the different power levels

Pull-up on Tx line really is useless and unnecessarily eats energy on transmit, but not enabling it will not change voltage levels with push-pull. To bring voltage levels to 3,0V, possibly for Your specific use You can try open-drain on 3,3V Tx and pull-up on 3,0V Rx, plus also turn off pull-up on 3,3V Rx. But then You must be sure that such a configuration is OK for specific line speed, length, environment noise and other physical factors.

P.S. Your screenshot shows Rx line, for which it is OK.

theo.brunner
Associate II

Because that's the status quo and monkeys writing code are not bothered with thinking!

Okay that is the answer I was looking for=) I thought there might be a reason why pull-up in CubeMX can't be disabled.

My configuration now is push-pull on both Tx lines and disabled pull-up on both sides for Tx and Rx. My scope shows me that the signals are looking quite okay.

Thank's for your help!

It may be related to https://community.st.com/s/question/0D50X0000BHyNbfSQF/what-state-are-gpios-in-if-they-are-set-to-alternative-function-but-the-controlling-peripheral-is-disabled - if the UART is disabled, the Tx pin's output enable may go inactive and the pin then may float to zero, possibly confusing the party on the other end of the wire.

It's not nice CubeMX does not allow to choose (with some sane defaults, and of course accompanied by extensive documentation and explanation 😉 ) but that's your well-deserved punishment for using a clicky tool instead of proper programming.

JW

Piranha
Chief II

Though on Rx sides pull-ups greatly lower an input impedance and therefore greatly improve robustness against EMI. If connection is wired, I would leave those on. =)

theo.brunner
Associate II

Thank you guys for your help. I thought I can use CubeMX at least for the low level initialization of the peripherals. But I see that this approach also has certain disadvantages.