We’ve built a custom board with an FTDI chip FT2232D to create 2 serial ports.
Our IOT slot, our LAN9512 chip and the FTDI chip are connected to an USB3503 USB hub (same one as on the mangOH Green board).
I’ve tested my custom Legato build 18.04 on the custom board with WP8548 and WP7607 targets.
At startup ftdi_sio gets loaded and creates ttyUSB0 and ttyUSB1.
The target console shows ‘usb 1-1.3: Detected FT2232C’ while the board is stuffed with an FT2232D chip.
The serial communication works in both directions without any problem when I use microcom on /dev/ttyUSB0 and /dev/ttyUSB1.
But, when I try to use these devices in my app, the serial communication doesn’t work.
My application uses le_tty API calls to configure the serial port and there is an fdMonitor with a serial port handler function.
None of these le_tty calls return an error in the application log, but, when I run dmesg in the target console,
I get messages like below :
ftdi_set_termios FAILED to set databits/stopbits/parity
ftdi_set_termios urb failed to set baudrate
urb failed to clear flow control
clear tt 3 (0040) error -71
Each time my handler function sends 5 characters to the serial port, I get
clear tt 3 (1042) error -71
I don’t understand why the le_tty calls don’t return errors, while the target console shows a lot of issues.
Any advice on this?
From your dmesg log, we can see several errors: usb 1-1: clear tt 3 (0040) error -71
Error -71 == -EPROTO
From <kernel>/Documentation/usb/error-codes.txt:
-EPROTO (*, **)
a) bitstuff error
b) no response packet received within the prescribed bus turn-around time
c) unknown USB error
( * ) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate hardware problems such as bad devices (including firmware) or cables.
Hi @JayM2M,
we already checked the explanation of -EPROTO, but, we don’t know how to debug this issue.
My le_tty API calls never return errors, and the serial communication works fine via microcom.
Any idea why the legato system and app would behave different than microcom?
Greetings,
annaertd
Issue was caused by a bad reset of the USB hub chip where our FTDI chip was connected to.
We fixed this, and now, my application has serial communication using the le_tty API with /dev/ttyUSB0 and /dev/ttyUSB1 without any problem.
If the USB hub chip got a reset after startup of the application, le_tty API didn’t show errors on /dev/ttyUSB0, although there were plenty of errors in the target console.
Even microcom still worked fine on /dev/ttyUSB0, which is very hard to understand.