I am new to the esp32 but not programming. I have a new project but have a strange issue. I am using serial1 and serial2 and both ports are used to transfer rs485 data.
The data being sent to serial1 is a three byte packet, followed by by a delay of approximately 2.5ms and then repeated. I read the data and echo each byte to the opposing serial port and also to the monitor port for display. The serial speed is 9600 baud but the monitor port is running at 115,200 baud so it does not add any delay. However when I look on the scope the following happens.
Data in as above three bytes, 2.5ms delay repeat
Data out nine bytes (3 x 3 bytes as one packet) approx 10ms delay repeat.
I can not understand why this is happening. The loop code is as follows:
Code: Select all
void loop(){
if (Serial1.available()) {
S_Data1 = Serial1.read();
//Serial.print(char(S_Data1));
Serial2.write(S_Data1);
if (S_Data1<0x10) {Serial.print("0");}
Serial.print(S_Data1,HEX);
Serial.print(" ");
if (S_Data1 == 0x23){
Serial.print(char(13));
Serial.print(char(10));
}
}
Thanks in advice
Ian