I want to take the readings(output) from a Radar that has RS232 interface using an Olimex ESP32-POE. I am planning to use the UEXT connector of the ESP to connect to the RS232 interface.
The problem is that this is the first project in which I am trying to use the serial communication of the ESP and I have no idea what to write in code.
This is the only relevant piece of code I found:
#define RXD2 16
#define TXD2 17
char c;
String readString;
void setup() {
// Note the format for setting a serial port is as follows: Serial2.begin(baud-rate, protocol, RX pin, TX pin);
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
Serial2.println("serial2test");
Serial.println("Serial Txd is on pin: " + String(TX));
Serial.println("Serial Rxd is on pin: " + String(RX));
}
void loop() {
while (Serial2.available()) {
c = Serial2.read();
readString += c;
}
if (readString.length() > 0) {
Serial.print(readString);
Serial2.print(readString);
//server.print(readString);
readString = "";
}
}
Here we can see that GPIO 16 and 17 are used for communicating with the RS232 interface. But, as I previously said, I want to use the UEXT Connector. What pins do I define ? Any advice ?
Can somebody point me in the right way ? Thank you !
Here we can see that GPIO 16 and 17 are used for communicating with the RS232 interface. But, as I previously said, I want to use the UEXT Connector. What pins do I define ? Any advice ?
According to Olimex example code it's 36 (RX) and 4 (TX).
I do the serial parsing in a different task.
If you need to change your pin numbers from the natural default you'd just initialize with the pin numbers like so LIDARSerial.begin ( SerialDataBits, SERIAL_8N1, 26, 25 );
The ESP32 does not have Serial1, Serial2, SerialXXXXXX
Out of curiosity I entered the words "esp32 serial" into my internet search engine to find a cht load of available examples on ESP32 Serial.