Skip to content

Serial.end() does not disconnect the Serial monitor  #7359

Closed
@fanfanlatulipe26

Description

@fanfanlatulipe26

Board

ESP-C3-32S-Kit and ESP32 Dev Kit

Device Description

ESP32 C3 board (or std ESP32)

Hardware Configuration

Nothing

Version

v2.0.5

IDE Name

Arduino IDE 1.8.19

Operating System

Windows 10

Flash frequency

80Mhz

PSRAM enabled

no

Upload speed

921600

Description

Need to use UART0 after a while, on pins others than the default pins used by uart0, the USB adaptor/Serial monitor.
Even after a Serial.end() and a new begin assigning the new pins to use by the newSerial link, the output are still going to the Serial Monitor.

A logic analyzer show that the correct bit stream is also generated on the new output pin New_TX
There is also a lot of pulses on New_RX, even with a pull up resistor

I have the same behavior on a ESP32 Dev Kit v1 but here the New_RX signal is clean.

ESP32C3 only have 2 UARTs and re-assigning UART0 is a must.

Sketch

#define New_RX 19   //
#define New_TX 18   //
//#define New_TX 21   //   U0TX ESP32C3
//#define New_RX 20   //   U0RX ESP32C3
HardwareSerial NewSerial(0);
void setup() {
  Serial.begin(115200);
  delay(2000);
  Serial.println("\n\nStarting on Serial, default pins, and ending Serial");
  Serial.flush();
  Serial.end();
  //delay(2000);
  NewSerial.begin(115200, SERIAL_8N1, New_RX, New_TX);
  //delay(2000);
  NewSerial.println("\n\n...now printing on NewSerial, others pins .. " );
  NewSerial.println(" but the message appears also on Serial Monitor ... " );
  NewSerial.flush();
  Serial.println("\n\n printing on Serial");  // No output: OK serial is closed
  Serial.flush();
  NewSerial.println("\n\n and once more printing on NewSerial");
  NewSerial.flush();
}

void loop() {
  // put your main code here, to run repeatedly:

}

Debug Message

Starting on Serial, default pins, and ending Serial


...now printing on NewSerial, others pins .. 
 but the message appears also on Serial Monitor ... 


 and once more printing on NewSerial

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions