Software Serial on ESP8266

Hi,
I've an issue with the SoftwareSerial library, running on ESP8266 12-E NodeMCU.

I'd like to use pin 4 (D2/GPIO4/SDA) as Rx (input for the micro-controller), and pin 0 (D3/GPIO0/FLASH) as Tx (output).

But it seems there's an issue with this setting.
I initialize the SoftwareSerial library with :
SoftwareSerial m_Software_Serial(4, 0);

After this the Rx pin (4) is forced to +3.3V.
Hopefully this doesn't create a short circuit, because I always insert a resistor (1 K) when I connect an external signal to a µC input pin.

Same result if I try to set this pin as input with :
pinMode(4, INPUT);
I guess this is not necessary, because also done by the SoftwareSerial library, it was just a trial.

If I don't initialize the SoftwareSerial library and just set this pin 4 as an input, I can connect a signal to it (via the 1K res.) and set its voltage to 0/3.3 V without problem.

Thanks for any explanation/suggestion.
Regards.

Why not use the second hardware serial port?

There is an alternate pin assignment for UART0 (GPIO 13 & 15) and there is UART1 which can only be used fir tx.

For the esp you should use espsoftwareserial

I can only comment on this. SoftwareSerial more than likely enables the internal pull-up resistor to prevent floating inputs.

1 Like

Hi all,

First, thanks for your suggestions and support.

I've been busy this week, so I just worked on this topic last evening.
I found the issue and solution.

The issue was in fact:

  • a inaccurate measurement tool (USB scope),
  • and a bad functional parameter (a too short receive time-out).

This prevented my sub-system to work.
The sub-system is a RS-485 adapter, which output is connected to a pin of the ESP8266.
This pin is configured as 'Rx' pin for library Software Serial.

When I noticed the issue of no message reception on the ESP8266, I put a probe scope on the Rx pin; but this probe has an internal impedance, and is probably connected to a + something inside the scope; this forced the signal to +5V. Using the probe with setting 'x10' (maybe this increases the probe impedance) allowed to restore a nominal signal on the Rx pin (to be sure I've added a 10 K pulldown).
With a correct signal, it was then easy to find and correct the second issue (reception time-out too low).

Every thing ok now. Sorry to have searched (and made some other searched) in the wrong direction.

Best regards
Claude B.

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