cancel
Showing results for 
Search instead for 
Did you mean: 

Uart / Usart: use Rx-pin only

Lukas Brändli
Associate
Posted on December 22, 2017 at 16:34

Hi

Is there an option to only use the Rx-pin of a uart / usart so that the Tx-pin can be used for something else (in my case SPI_SCK)?

If I enable a uart / usart in STM32CubeMx and go to the 'Configuration' tab I can change 'Data Direction' to 'Receive only'. But this doesn't disable the Tx-pin. 

Another way may be using half-duplex mode but then the Tx-pin would be used anyways and I couldn't use it for SPI. 

Note: I am still planning my own board and don't have any hardware to test.

Hopefully someone can help.

Regards

Lukas

#usart #usart-rx #uart #uart-rx
4 REPLIES 4
T J
Lead
Posted on December 25, 2017 at 21:19

You can switch Tx to a pin that does not come out of your package...

Which chip are you using, what package ?

Szymon PANECKI
Senior III
Posted on December 25, 2017 at 21:52

Hello Lukas,

On of USART modes is called Single Wire (Half Duplex). This mode uses single pin for USART and by using this pin USART is able to both transmit and receive. But as far as I know in all cases USART TX pin is used for this mode, so you would be able to use USART RX pin for different purpose.

USART Single Wire (Half Duplex) mode can be configured in Pinout tab of STM32CubeMX. Please see below the picture, which shows an example.

0690X00000609DsQAI.png

Regards

Szymon
S.Ma
Principal
Posted on December 26, 2017 at 09:02

Activating the UART cell and each GPIO (alternate function mode or else) are independent.

By extension you could also dynamically (time multiplex) several GPIOs tied to the same UART.

Posted on December 26, 2017 at 18:04

Should be able to just enable/use an RX pin for a USART for most STM32 parts. The F1 series can be a bit problematic as AF mapping is done at a peripheral rather than a pin level.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..