Skip to content

serial.end() doesn't work #3878

Closed
Closed
@aster94

Description

@aster94

Description:

Serial.end() should free the serial pins and leave the user the ability to do digitalWrite() on them, but it doesn't work. Instead to drive the TX pin to a LOW state i need to reset the board.

I tested the code below with the following cores:

I also made three logic analyzer captures: la.zip
An example from one of these, as you can see it shows that the pin is driven low only once (after upload of the code or reset)

image

Sketch:

#include <Arduino.h>

HardwareSerial ser(2);
#define TX_PIN 17

void setup(){}

void loop()
{
    pinMode(TX_PIN, OUTPUT);
    delay(10);

    digitalWrite(TX_PIN, HIGH);
    delay(50);
    digitalWrite(TX_PIN, LOW);
    delay(300);
    digitalWrite(TX_PIN, HIGH);
    delay(50);

    ser.begin(9600);
    delay(10);

    for (uint8_t n = 1; n < 5; n++)
    {
        ser.write(n);
        delay(10);
    }
    ser.end();
    delay(300);
}

NOTE: looks like that the problem was here before #3713 and #3664

Metadata

Metadata

Assignees

Labels

Status: StaleIssue is stale stage (outdated/stuck)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions