Size of USB RX and TX EndPoints in Teensy 3.2

Status
Not open for further replies.

tadryanom

New member
Hello guys!

I would like to know if it is possible to change the quantity and increase the size of the USB Endpoints (RX and TX) from 64 to 128 bytes in the Teensy 3.2 on RAWHID mode.

Thanks.
 
The answer really depends on what's meant by "possible".

There is no simple & easy way to do this with the current USB code. It's all designed around a single packet / token per polling interval. 64 bytes is the maximum packet size. So if "possible" means just changing some number or settings in the code, then no.

If "possible" means writing very different USB code, then maybe. But that is incredibly difficult. It requires good programming skill and deep knowledge of USB. Sometimes troubleshooting can be done with software that captures your computer's USB communication, but usually an expensive USB protocol analyzer is used for this sort of work. Without those skills and tools, it's not really "possible".

Whether HID drivers on Windows, Linux & MacOS accept a multi-packet transfer is also a good question. I've never tried that (as you might guess from the code's design to use only a single packet).
 
The code posted on pastbin (ct_hidraw.ino) is my crude implementation for handling data received and sent via USB in RAWHID mode. Uncommented code is what works, commented code does not work. Although I tried something useful by changing the usb_desc.h file to support 128 bytes, I was not successful:

Modified part of usb_desc.h:
********************************
#elif defined(USB_RAWHID)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0486
#define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
#define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
#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_USB_BUFFERS 12
#define NUM_INTERFACE 2
#define RAWHID_INTERFACE 0 // RawHID
#define RAWHID_TX_ENDPOINT 3
// #define RAWHID_TX_ENDPOINT 2
#define RAWHID_TX_SIZE 64
// #define RAWHID_TX_SIZE 128
#define RAWHID_TX_INTERVAL 1
#define RAWHID_RX_ENDPOINT 4
// #define RAWHID_RX_ENDPOINT 2
#define RAWHID_RX_SIZE 64
// #define RAWHID_RX_SIZE 128
#define RAWHID_RX_INTERVAL 1
#define SEREMU_INTERFACE 1 // Serial emulation
#define SEREMU_TX_ENDPOINT 1
#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 ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
********************************

I tried to change the values of the lines where the following definitions are: RAWHID_TX_ENDPOINT, RAWHID_TX_SIZE, RAWHID_RX_ENDPOINT and RAWHID_RX_SIZE, what I had as an answer were just crashes.
 
Status
Not open for further replies.
Back
Top