SoftwareSerial brings pins HIGH

Hello. Im trying to use SoftwareSerial but i encountered a really weird bug. This is my code:

#include <SoftwareSerial.h>
SoftwareSerial BTSerial(7, 8);

void setup() {
  BTSerial.begin(9600);
}

void loop() {
  
}

This is supposed to turn pin 7 and 8 into serial pins, but instead it brings them both to constant 5V. Why is this happening?

Why is this happening?

Because it is supposed to. Why is this a problem?

Because im not communicating anything over the pins. I could understand if TX would be high because its trying to send some information, but RX should be low if its supposed to receive data.

but RX should be low if its supposed to receive data.

The other end pulls RX low to make it receive data. The Arduino pulls TX low to send data.

What is hooked to the input pin? If it is floating it could be anything, though it is possible that the internal pull-ups are active.

Oh, i didn't know that, thank you. Its confusing, because i was using this design to communicate with a Bluetooth module that can only handle 3.3V and none of the documentation on the internet suggested to also do a voltage divider on RX from the arduino. Because i thought it was the BT module that was sending signals on the serial RX(to arduino) pin i assumed that there wasnt any risk that that pin could get over 3.3V, and the module is now destroyed.

KeithRB: If it is floating it could be anything, though it is possible that the internal pull-ups are active.

For normal polarity, SoftwareSerial activates the internal pull-up for RX. If it didn't do this an unconnected input could generate frequent interrupts. It sets the TX line high since that's the idle state.

(I wouldn't think that a pin with the internal pullup would burn out a "3.3v-only" input on a connected device. The pullup is a pretty large resistor, and should limit current to levels that are likely to be safe...)

jammasterz:
Hello. Im trying to use SoftwareSerial but i encountered a really weird bug. This is my code:

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(7, 8);

void setup() {
 BTSerial.begin(9600);
}

void loop() {
 
}



This is supposed to turn pin 7 and 8 into serial pins, but instead it brings them both to constant 5V. Why is this happening?

Instead? OMG!

SoftwareSerial is emulating a hardware serial port in software.
So what's the voltagelevel on hareware serial ports?

Perhaps use an Aruino UNO and in the setup do !"Serial.begin(9600);", then measure pin-0 and pin-1vcoltage?
!What do you expect? What is the measurement?

i was using this design to communicate with a Bluetooth module that can only handle 3.3V and none of the documentation on the internet suggested to also do a voltage divider on RX from the arduino.

That’s because a voltage divider isn’t really appropriate. There are properly designed voltage reduction devices available with several channels for your purpose.