Serial output FTDI USB-Serial Macos data garbled

esp32-user
Posts: 10
Joined: Sat Mar 05, 2022 6:54 pm

Serial output FTDI USB-Serial Macos data garbled

Postby esp32-user » Tue Mar 08, 2022 1:35 pm

I'm using a FTDI USB-Serial adapter with macos, and getting garbled data, but somewhat consistently garbled.

I'm sending this:

Code: Select all

uint8_t buffer[] = {
  0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f

} ;
and getting this, which repeats consistently:

Code: Select all

0001c30    f1f3    edef    e9eb    e5e7    e1e3    dddf    d9db    d5d7
0001c40    d1d3    cdcf    c9cb    c5c7    c1c3    fd00    f9fb    f5f7
0001c50    f1f3    edef    e9eb    e5e7    e1e3    dddf    d9db    d5d7
0001c60    d1d3    cdcf    c9cb    c5c7    c1c3    fd00    f9fb    f5f7
0001c70    f1f3    edef    e9eb    e5e7    e1e3    dddf    d9db    d5d7
0001c80    d1d3    cdcf    c9cb    c5c7    c1c3    fd00    f9fb    f5f7
0001c90    f1f3    edef    e9eb    e5e7    e1e3    dddf    d9db    d5d7
0001ca0    d1d3    cdcf    c9cb    c5c7    c1c3    fd00    f9fb    f5f7
This is the repeating part which starts at (I believe) the 0 that I send:

Code: Select all

dddf    d9db    d5d7    d1d3    cdcf    c9cb    c5c7    c1c3    fd00    f9fb    f5f7    f1f3    edef    e9eb    e5e7    e1e3
Here is my test case:

Code: Select all

#include <HardwareSerial.h>

#define RXD1 13
#define TXD1 12

HardwareSerial EFISSerial2(2);

void setup(){
  Serial.begin(115200);
  EFISSerial2.begin(115200, SERIAL_8N1, RXD1, TXD1);
  delay(5000);
}

uint8_t buffer[] = {
  0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
} ;

void loop() {

  if (EFISSerial2.availableForWrite() >= sizeof(buffer)) EFISSerial2.write(buffer, sizeof(buffer));
  delay(1000);

}
This could be a problem with the config on the mac. My stty output seems to be what I want:

Code: Select all

$ stty -a -f  /dev/cu.usbserial-FT55X6HR 115200
speed 115200 baud; 0 rows; 0 columns;
lflags: -icanon -isig -iexten -echo -echoe -echok -echoke -echonl
	-echoctl -echoprt -altwerase -noflsh -tostop -flusho -pendin
	-nokerninfo -extproc
iflags: -istrip -icrnl -inlcr -igncr -ixon -ixoff -ixany -imaxbel -iutf8
	-ignbrk -brkint -inpck -ignpar -parmrk
oflags: -opost -onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
	-dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
	eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
	min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
	stop = ^S; susp = ^Z; time = 0; werase = ^W;
I did a less detailed check on my PC with Win10, and also got garbled data.

Has anyone see this problem and have a hint how to fix it?

esp32-user
Posts: 10
Joined: Sat Mar 05, 2022 6:54 pm

Re: Serial output FTDI USB-Serial Macos data garbled

Postby esp32-user » Wed Mar 09, 2022 7:26 am

I put the ESP32 on a cheap oscilloscope and it seems to be sending correct data. I suspect that something is wrong with my usb-serial cable. I will update if I find anything.

Image

Image

Image

Who is online

Users browsing this forum: No registered users and 84 guests