Skip to content

ESP32S2 - Serial.Flash() is not waiting for transmission to end #4603

Closed
@DawidDiaco

Description

@DawidDiaco

Hardware:

Board: ESP32-S2 Wrover
Core Installation version: unofficial - branch - esp32s2, commit baaff84 and release/4.2-beta1 of ESP-IDF
IDE name: Visual Studio with VisualGDB
Flash Frequency: 80Mhz
PSRAM enabled: I don't have a clue how to check it
Upload Speed: 115200
Computer OS: Windows 10 Pro

Description:

I'm using Serial1 for communicating with modbus device. For that I found a great library that relies on Serial.Flash() for ensuring that transmission has ended. What we found out in this issue: emelianov/modbus-esp8266#85, Arduino liblaries are bugged, and Serial.Flush() is not waiting for the end of transmision.

Sketch:

#include <Arduino.h>

void setup() 
{
	Serial1.begin(9600, SERIAL_8E1, GPIO_RXD, GPIO_TXD);
	pinMode(GPIO_RTS, OUTPUT);
}

void loop() 
{
	digitalWrite(GPIO_RTS, HIGH);
	uint8_t data[] = { 0x0, 0x1, 0x2, 0x3, 0x4 };
	Serial1.write(data, 4);
	Serial1.flush();
	digitalWrite(GPIO_RTS, LOW);
	
	delay(1000);
}

Debug Messages:

IMG_20201201_193140

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