Field initialization of product

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: Field initialization of product

Postby mzimmers » Mon Sep 17, 2018 10:47 pm

Hi Tom - the powers that be have dictated that I include a serial interface, so there's no getting away from it now. I'll return my attention to more elegant alternatives after I get this working.

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: Field initialization of product

Postby tommeyers » Mon Sep 17, 2018 10:59 pm

Here is my working code to connect a second hardware serial port; I had problems with the other uart/gpio combinations. Maybe this will save you a few minutes.

#include <HardwareSerial.h>
HardwareSerial hardwareSerial2(2);
void setup() {
Serial.begin(115200);
delay(1000);
hardwareSerial2.begin(115200, SERIAL_8N1, 16, 17); GPIO 16,17
}
void loop() {
hardwareSerial2.write("aaa\n");
delay(1000);
while (hardwareSerial2.available() > 0) {
Serial.print( (char) hardwareSerial2.read());
}
}

Tom Meyers
IT Professional, Maker
Santiago, Dominican Republic

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: Field initialization of product

Postby mzimmers » Tue Sep 18, 2018 5:15 pm

Thanks, Tom. My board is using UART1 with the default pins...I'm trying to send it about 80 bytes of data, but it can't handle it all. I get a "uart rx break" (whatever that is) after about 65 bytes read, and subsequent reads produce garbage.

It's as though either the FTDI chip or the ESP32 UART is getting overrun, but I just find that hard to believe. Not sure where to go from here...

EDIT: sometimes I get uart frame errors as well. Weird stuff.

EDIT #2: above I wrote that "subsequent reads produce garbage;" this isn't strictly true. The contents of the subsequent reads are all null characters.

So, here's the sequence of events:

1. I get part of my incoming message (about 65 bytes worth)
2. I get a uart rx break
3. I get several more read events, of varying lengths, with data all null.
4. Each of these subsquent reads then gets a uart rx break.

Who is online

Users browsing this forum: No registered users and 141 guests