I'm encountering a puzzling issue with Teensy 4.0 USB configurations and Serial debug output. I have two USB configurations defined in usb_desc.h:
Configuration 2: USB_KEYBOARD_RAWHID (DOESN'T WORK)
The Problem:
Both configurations have identical SEREMU definitions:
What I've Tried:
My Questions:
Environment:
I'm particularly puzzled because the SEREMU definitions look functionally identical between the two configurations. Any insights into what might be causing this interface-specific failure would be greatly appreciated.
Has anyone else encountered similar issues with custom USB configurations where adding additional HID interfaces breaks SEREMU functionality?
Code:
#elif defined(USB_RAWHID)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0486
#define RAWHID_USAGE_PAGE 0xFFAB
#define RAWHID_USAGE 0x0200
#define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
#define MANUFACTURER_NAME_LEN 11
#define PRODUCT_NAME {'T','e','e','n','s','y','d','u','i','n','o',' ','R','a','w','H','I','D'}
#define PRODUCT_NAME_LEN 18
#define EP0_SIZE 64
#define NUM_ENDPOINTS 4
#define NUM_INTERFACE 2
#define RAWHID_INTERFACE 0
#define RAWHID_TX_ENDPOINT 3
#define RAWHID_TX_SIZE 64
#define RAWHID_TX_INTERVAL 1
#define RAWHID_RX_ENDPOINT 4
#define RAWHID_RX_SIZE 64
#define RAWHID_RX_INTERVAL 1
#define SEREMU_INTERFACE 1 // Serial emulation
#define SEREMU_TX_ENDPOINT 2
#define SEREMU_TX_SIZE 64
#define SEREMU_TX_INTERVAL 1
#define SEREMU_RX_ENDPOINT 2
#define SEREMU_RX_SIZE 32
#define SEREMU_RX_INTERVAL 2
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED
Configuration 2: USB_KEYBOARD_RAWHID (DOESN'T WORK)
Code:
#elif defined(USB_KEYBOARD_RAWHID)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0486
#define RAWHID_USAGE_PAGE 0xFFAB
#define RAWHID_USAGE 0x0200
#define MANUFACTURER_NAME {'X','x','x','x','x','x','x','x','x'}
#define MANUFACTURER_NAME_LEN 9
#define PRODUCT_NAME {'X','x','x','x','x','x','x','x','x'}
#define PRODUCT_NAME_LEN 9
#define EP0_SIZE 64
#define NUM_ENDPOINTS 6
#define NUM_INTERFACE 4
#define KEYBOARD_INTERFACE 0
#define MOUSE_INTERFACE 1
#define SEREMU_INTERFACE 2
#define RAWHID_INTERFACE 3
#define KEYBOARD_ENDPOINT 3
#define KEYBOARD_SIZE 16
#define KEYBOARD_INTERVAL 1
#define MOUSE_ENDPOINT 5
#define MOUSE_SIZE 8
#define MOUSE_INTERVAL 1
#define SEREMU_TX_ENDPOINT 2
#define SEREMU_TX_SIZE 64
#define SEREMU_TX_INTERVAL 1
#define SEREMU_RX_ENDPOINT 2
#define SEREMU_RX_SIZE 32
#define SEREMU_RX_INTERVAL 2
#define RAWHID_TX_ENDPOINT 4
#define RAWHID_TX_SIZE 64
#define RAWHID_TX_INTERVAL 1
#define RAWHID_RX_ENDPOINT 6
#define RAWHID_RX_SIZE 64
#define RAWHID_RX_INTERVAL 1
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED
The Problem:
- USB_RAWHID: Serial debug output works perfectly with Serial.println()
- USB_KEYBOARD_RAWHID: No serial debug output appears, even though the code compiles and uploads successfully
Both configurations have identical SEREMU definitions:
- Same SEREMU_INTERFACE (though different interface numbers: 1 vs 2)
- Same SEREMU endpoints, sizes, and intervals
- Same ENDPOINT2_CONFIG for SEREMU
What I've Tried:
- Extended Serial.begin() delays (up to 5 seconds)
- Added Serial connection timeout checks
- Verified SEREMU_INTERFACE is properly defined
- Confirmed the Arduino Serial Monitor is working with USB_RAWHID
My Questions:
- Why would USB_RAWHID work but USB_KEYBOARD_RAWHID fail for Serial debug when the SEREMU definitions appear identical?
- Could there be interface conflicts or enumeration order issues with the additional Keyboard/Mouse interfaces?
- Is there something about the endpoint configuration that could prevent SEREMU from functioning properly in the multi-interface configuration?
Environment:
- Teensy 4.0
- Arduino IDE 1.8.19
- Teensyduino 1.58
- Custom USB configuration (cannot change USB Type)
I'm particularly puzzled because the SEREMU definitions look functionally identical between the two configurations. Any insights into what might be causing this interface-specific failure would be greatly appreciated.
Has anyone else encountered similar issues with custom USB configurations where adding additional HID interfaces breaks SEREMU functionality?