Definite state of USART pins

When calling Serial.begin() are the RX and TX pin declared input and output respectively?

Is the same true for softwareSerial?

If so does this make it safe to connect the RX pin (of a 5v MCU) directly to a corresponding TX pin with a lower USART voltage?

Hello andyroid

Take a search engine of your choice and ask the WWW for 'serial +arduino' and 'softwareSerial +arduino' to collect some data to be sorted out to get the needed information.

A level shifter is a good selection to connect Arduino with different logic voltage levels.

Yes I can find plenty of information about the serial function but not about how the hardware is implemented. Maybe because it's so generalized that most people don't (especially Arduino users) need to consider it. Maybe you know where to find the information because you know all about it, but for novices its sometimes difficult to understand what to search for. That's why forums exist

Take a view into the datasheet of the Arduino and MCU used.

Here you will find Serial.cpp and Serial.h.
If you have experience with C coding, it is possible that you will find the answer to your question here.

C:\Users\xxxxx\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.1.6\cores\arduino

Hardware serial pins are defined in the hardware, so they are as manufactured in the chip.

Yes, because the voltage you are feeding into the Rx pin is lower than it's designed for. Going the other way you must use something to lower the voltage from the 5V Tx pin to the lower voltage accepted by the Rx pin. A pair of resistors in a potential divider is usually sufficient.

Is there a guarantee that the RX pin of the 5V MCU is indeed configured for serial? I mean, you could have an older code in that 5V MCU that uses the RX pin as an output. As a result, you will have two outputs driving each other.

If you add a resistor in series with the RX pin of the 5V MCU you can prevent damage. Same for the RX pin of the lower voltage MCU. If you look at the schematic of an official Uno, you will find two resistors between the 16U2 and the 328P for that purpose; this allows you to use the Uno's RX pin as an output without blowing up the 16U2 via the TX pin.

1 Like

Yes this is what I was trying to clarify,thank you. I was concerned that I would need to reduce the voltage on the RX pin too, but as this will be configured as an input, it can not put out a voltage.

Yes the RX pin will be configured at setup with serial.begin so in that sense it guarantees the mode of the pin. I want it to communicate with a Chinese sim7600 modem who's UART voltage is 3.3v. but the info for the device is sketchy and sim 7600 datasheet says it's 1.8v. so I'm thinking there must be a level shifter of some kind, albeit there doesn't seem to be a level shifter on board.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.