Serial Data Not Appearing in Arduino Serial Monitor

CM207

Member
Hi everyone,

I'm working on a Teensy 4.1 project where I have created a custom USB type. My setup includes multiple HID interfaces, and I've also included the serial emulation interface (SEREMU_INTERFACE).

The issue I'm encountering is that when I use my custom USB type, Serial.print() data does not appear in the Arduino Serial Monitor. However, I can see the data using Wireshark, and that the Teensy is sending the data via interrupt transfers. Strangely, the predefined USB_HID type with serial emulation sends the exact same HID data in the exact same way and displays the data in the Serial Monitor as expected; the only difference is the endpoint.

Has anyone faced a similar issue? Any insights would be greatly appreciated!
 
Did you change the PID/VID? Might be worth posting the config of your custom USB device, just in case there could be an issue there.
 
seremu is handled by teensy_monitor, if you've changed the interface around it probably doesn't know how to read it any more.
 
I did not make any changes except to the interfaces. I analyzed all of the USB traffic, and the behavior matches that of the predefined USB_HID type exactly - except that it does not display output on the serial monitor.
 
If you've changed the VID+PID then the program won't recognize the device.
If you've reused the VID+PID but have changed the interface numbers, endpoint addresses etc. then you've broken what the program expects a device with that VID+PID to have. And if the data doesn't reach teensy_monitor, it's not going to make it to the IDE serial monitor.
 
I did not make any changes except to the interfaces. I analyzed all of the USB traffic, and the behavior matches that of the predefined USB_HID type exactly - except that it does not display output on the serial monitor.
Sorry, obviously very little we can do to help here as, we have not seen the USB descriptor data, nor know if it has custom PID:VID...

Things I would try include:
a) Does it work with TyCommander?

b) If you have another Teensy that has USB Host connector available, try plugging it into it, running the sketch HIDDeviceInfo
and see if it shows anything interesting.
 
If you've changed the VID+PID then the program won't recognize the device.
If you've reused the VID+PID but have changed the interface numbers, endpoint addresses etc. then you've broken what the program expects a device with that VID+PID to have. And if the data doesn't reach teensy_monitor, it's not going to make it to the IDE serial monitor.
That actually makes sense.

Here is my custom usb type:
C++:
#if defined(USB_CUSTOM)
#define VENDOR_ID        0x16C0
#define PRODUCT_ID        0x0482
#define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
#define MANUFACTURER_NAME_LEN    11
#define PRODUCT_NAME        {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
#define PRODUCT_NAME_LEN    23
#define EP0_SIZE 64
#define NUM_ENDPOINTS 5
#define NUM_USB_BUFFERS    24
#define NUM_INTERFACE    4
#define MOUSE_INTERFACE 0
#define MOUSE_ENDPOINT 1
#define MOUSE_SIZE 64
#define MOUSE_INTERVAL 1
#define KEYBOARD_INTERFACE 1
#define KEYBOARD_ENDPOINT 2
#define KEYBOARD_SIZE 64
#define KEYBOARD_INTERVAL 1
#define CUSTOM_INTERFACE 2
#define CUSTOM_ENDPOINT 3
#define CUSTOM_SIZE 64
#define CUSTOM_INTERVAL 1
#define SEREMU_INTERFACE 3
#define SEREMU_TX_ENDPOINT 4
#define SEREMU_TX_SIZE 64
#define SEREMU_TX_INTERVAL 1
#define SEREMU_RX_ENDPOINT 4
#define SEREMU_RX_SIZE 32
#define SEREMU_RX_INTERVAL 2
#define ENDPOINT1_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT

Am I able to adjust what the program expects?

Sorry, obviously very little we can do to help here as, we have not seen the USB descriptor data, nor know if it has custom PID:VID...

Things I would try include:
a) Does it work with TyCommander?

b) If you have another Teensy that has USB Host connector available, try plugging it into it, running the sketch HIDDeviceInfo
and see if it shows anything interesting.
a) I will check.
b) Unfortunately, I don't have another teensy.

Thanks for your help already!
 
Try running teensy_discovery in a terminal or command prompt window. Find it in the package Arduino IDE installed (~/Libraries/Arduino15 on MacOS, .aduino15 on Linux, {AppData}/Local/Arduino15 on Windows).

Once it's running, type START_SYNC. You should see it print this:

Code:
{
"eventType": "start_sync",
"message": "OK"
}

Then as Teensy devices come and go, you'll see JSON format info printed. Hopefully the info is easy to understand, but this is the Arduino specification if you want the details.

Maybe if you compare the JSON for your custom device versus what it prints for the original unmodified code, perhaps something different will offer some insight into what's wrong?
 
Back
Top