Teensy 4.0 USB Host help

HR619

New member
Hi all,

I am currently using a teensy 4.0 to communicate with a esp-32 s3 using the USB host pins on the the teensy (D+ and D- on the underside). It works fine when using a baud rate of 115200 to communicate but I am now trying to use 921600 as that is what the system I am working with runs at now and it just won't work. I went into the USBHost_t36.h file and changed the baud rate to 921600 as well as the serial.cpp file but to no avail. Is there anything I may be doing wrong here or any other solutions I could try. Just to note I am using PlatformIO to upload to the teensy

Thanks,
-HR
 
Last edited:
I believe from your description, that the T4 and the ESP32 S3 are communicating over USB with the ESP32 logically plugged into the
Teensy. So, they are communicating over USB. Where the Baud rate means almost nothing. Except that the USB Host, in this case the
teensy will send a configuration message to the device and the device may or may not care. Some care, as they may use this to configure
something like a hardware UART to talk to some other hardware (either part of it or external) at that baud rate.

But what might matter with this baud rate, is, the amount of data being sent and if something is being overrun. I believe the S3 USB is only
USB Full speed 12MBits per second max, I am guessing that the about 1Mbits per second might be pushing things at least in the default
configuration.

If you are trying to use the USBSerial object, you might try using the USBSerial_BigBuffer object and see if that helps.
Like the one in the examples:
Code:
USBSerial_BigBuffer userial(myusb, 1); // Handles anything up to 512 bytes

If that does not work, then someone would probably need to debug it as it might require additional buffers, and transfer objects to try to
keep up. And that is assuming that it is the USBHost code not keeping up. Maybe the problem is on the ESP32 side, or maybe it is
the code on the Teensy that is trying to produce or process the data.

Good luck
 
I believe from your description, that the T4 and the ESP32 S3 are communicating over USB with the ESP32 logically plugged into the
Teensy. So, they are communicating over USB. Where the Baud rate means almost nothing. Except that the USB Host, in this case the
teensy will send a configuration message to the device and the device may or may not care. Some care, as they may use this to configure
something like a hardware UART to talk to some other hardware (either part of it or external) at that baud rate.

But what might matter with this baud rate, is, the amount of data being sent and if something is being overrun. I believe the S3 USB is only
USB Full speed 12MBits per second max, I am guessing that the about 1Mbits per second might be pushing things at least in the default
configuration.

If you are trying to use the USBSerial object, you might try using the USBSerial_BigBuffer object and see if that helps.
Like the one in the examples:
Code:
USBSerial_BigBuffer userial(myusb, 1); // Handles anything up to 512 bytes

If that does not work, then someone would probably need to debug it as it might require additional buffers, and transfer objects to try to
keep up. And that is assuming that it is the USBHost code not keeping up. Maybe the problem is on the ESP32 side, or maybe it is
the code on the Teensy that is trying to produce or process the data.

Good luck
Thank you for all the info! I will try these steps and see if I am able to resolve the issue. I am in fact already using USBSerial_BigBuffer, some additional info I think may be relevant to this is that the teensy goes to connects to a USB to RS485 converter which then connects to the ESP32
 
Last edited:
Back
Top