Skip to content

HardwareSerial freezing ESP32 #3563

Closed
Closed
@maribeiro

Description

@maribeiro

Hardware:

Board: ESP32 Custom board
Core Installation version: 1.11.1
IDE name: Platform.io
Flash Frequency: default
PSRAM enabled: default
Upload Speed: 115200
Computer OS: Linux

Description:

I'm using a board with ESP32 and a gps device (GPS TX) connected to ESP32 GPIO_NUM_16.
My basic sketch starts Serial2 with a specific baud rate for communicating with the GPS and reads the serial2 port , printing incoming data and then ends the serial communication. Then the cycle repeats (this is because i then want to use the same Serial Port to communicate with another device)
What happens is that after a random time the ESP just freezes. No more incoming data, if i put some other debug print inside the loop, it just doesnt get printed anymore.

The device doesnt throw any exception, it just freezes completely.

Sketch:

//Change the code below by your sketch
#include "Arduino.h"

void setup()
{
  Serial.begin(115200);
  Serial.println("Starting...");
}

void printFromSerial()
{
  unsigned long start = millis();
  do
  {
    while (Serial2.available()) {
      int r = Serial2.read();
      Serial.print(r);
    }
  } while (millis() - start < 1000);
}

void loop()
{
   Serial2.begin(9600, SERIAL_8N1, GPIO_NUM_16, GPIO_NUM_12, false);
   printFromSerial();
   Serial2.end();
}

Debug Messages:

no messages show , device just freezes.

Metadata

Metadata

Assignees

No one assigned

    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