Frozen RS232 device with ESP32 + TTL Converter
Posted: Sun Nov 19, 2017 12:31 am
Hi,
I have a SparkFun ESP32 Thing and MAX3232 Converter Module with wiring and code as shown. Of course, I'm just trying to read off RS232 and do something after each 0x7e20 is received. But, the data device keeps getting hung and no serial reading takes place. Swapping Arduino UNO/SoftwareSerial (additional code below) with the same data device and MAX3232 works fine.
The data device just won't work with the ESP32 Thing despite different HardwareSerial combinations of UART and "safer" RX/TX (e.g. 16, 17) pins as well as a 4400mAh 3.7v to rule out excessive Wifi power drain. I've also unsuccessfully tried the ESP32 Thing with ESP SoftwareSerial (https://github.com/jdollar/espsoftwareserial/)
So, any hardware or software advice as to why my ESP32 Thing setup fails where the Arduino UNO succeeds will be GREATLY appreciated.
... with this code
I have a SparkFun ESP32 Thing and MAX3232 Converter Module with wiring and code as shown. Of course, I'm just trying to read off RS232 and do something after each 0x7e20 is received. But, the data device keeps getting hung and no serial reading takes place. Swapping Arduino UNO/SoftwareSerial (additional code below) with the same data device and MAX3232 works fine.
The data device just won't work with the ESP32 Thing despite different HardwareSerial combinations of UART and "safer" RX/TX (e.g. 16, 17) pins as well as a 4400mAh 3.7v to rule out excessive Wifi power drain. I've also unsuccessfully tried the ESP32 Thing with ESP SoftwareSerial (https://github.com/jdollar/espsoftwareserial/)
So, any hardware or software advice as to why my ESP32 Thing setup fails where the Arduino UNO succeeds will be GREATLY appreciated.
... with this code
Code: Select all
/* ESP32 Thing code */
HardwareSerial Serial1(1);
#define SERIAL1_RXPIN 13
#define SERIAL1_TXPIN 12
void setup() {
Serial.begin(115200);
Serial1.begin(1200, SERIAL_8N1, SERIAL1_RXPIN, SERIAL1_TXPIN);
}
void loop() {
while(Serial1.available()<2);
if (Serial1.read() == 0x7e && Serial1.read() == 0x20) {
Serial.println("Header received!");
}
}
Code: Select all
/* Arduino UNO code */
#include <SoftwareSerial.h>
SoftwareSerial Serial1(13,12); // RX, TX
void setup() {
Serial.begin(115200);
Serial1.begin(1200);
}
void loop() {
while(Serial1.available()<2);
if (Serial1.read() == 0x7e && Serial1.read() == 0x20) {
Serial.println("Header received!");
}
}