Hello,
I posted about a year ago about an issue with my mice being stuck at 500 Hz using USBHost_t36. Back then I though it could be a hardware problem.
I unfortunatly reproduce the same issue on a teensy 4.0.
I looked into it again and I found some very strange results. I noticed switching usb type got the usbhost to pull at 1000 hz.
For test purposes I use a teensy 3.6 to emulate a mouse (simple mouse moves in the loop)
and the teensy 4.0 USBHost_t36 sample app with an extra
in the mouse1.available() condition to measure the polling rate.
I made a custom usb type which consists of 1 to 2 interfaces - it depends on the tests - , Mouse and Keyboard (on the teensy 3.6).
The results are :
Mouse only : stuck to 500 hz
Mouse + keyboard (KEYBOARD_INTERVAL 1) : 1000 hz !! (So it can actually work at 1000 Hz!)
Mouse + keyboard (KEYBOARD_INTERVAL 2) : 500 hz (unexpected, but this made me think the issue could actually be linked to the periodic table)
So I checked the periodic tables for each case :
: I am not sure it works like that but 200061A0 seems to represent the keyboard, so why would it appear every line when it should be 20006200 everyline and a node with 200061A0 every 2 lines
Any idea ? Or am I on the wrong track and the issue is somewhere else in the code ?
I posted about a year ago about an issue with my mice being stuck at 500 Hz using USBHost_t36. Back then I though it could be a hardware problem.
I unfortunatly reproduce the same issue on a teensy 4.0.
I looked into it again and I found some very strange results. I noticed switching usb type got the usbhost to pull at 1000 hz.
For test purposes I use a teensy 3.6 to emulate a mouse (simple mouse moves in the loop)
Code:
Mouse.move(5, 0, 0);
delay(1);
Mouse.move(0, 5, 0);
delay(1);
Mouse.move(-5, 0, 0);
delay(1);
Mouse.move(0, -5, 0);
delay(1);
and the teensy 4.0 USBHost_t36 sample app with an extra
Code:
static elapsedMillis pollingRateElapsedMillis;
static int32_t pollingRateCounter;
pollingRateCounter++;
if (pollingRateElapsedMillis > 999) {
Serial.printf("Hertz=%d\n", pollingRateCounter);
pollingRateElapsedMillis = 0;
pollingRateCounter = 0;
}
I made a custom usb type which consists of 1 to 2 interfaces - it depends on the tests - , Mouse and Keyboard (on the teensy 3.6).
Code:
#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 1 // 2 when enabling keyboard
#define NUM_USB_BUFFERS 2
#define NUM_INTERFACE 1 // 2 when enabling keyboard
#define MOUSE_INTERFACE 0 // Mouse
#define MOUSE_ENDPOINT 1
#define MOUSE_SIZE 8
#define MOUSE_INTERVAL 1
/*#define KEYBOARD_INTERFACE 1 // Keyboard
#define KEYBOARD_ENDPOINT 2
#define KEYBOARD_SIZE 8
#define KEYBOARD_INTERVAL 1*/
#define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
//#define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_ONLY
The results are :
Mouse only : stuck to 500 hz
Mouse + keyboard (KEYBOARD_INTERVAL 1) : 1000 hz !! (So it can actually work at 1000 Hz!)
Mouse + keyboard (KEYBOARD_INTERVAL 2) : 500 hz (unexpected, but this made me think the issue could actually be linked to the periodic table)
So I checked the periodic tables for each case :
Code:
500 hz mouse only
Periodic Schedule:
0: 20006200
1: 20006200
2: 20006200
3: 20006200
... (until 31)
Code:
1000 hz Mouse + keyboard
Periodic Schedule:
0: 20006200 -> 200061A0
1: 20006200 -> 200061A0
2: 20006200 -> 200061A0
3: 20006200 -> 200061A0
... (until 31)
Code:
500 hz Mouse + keyboard interval 2
Periodic Schedule:
0: 20006200 -> 200061A0
1: 200061A0
2: 20006200 -> 200061A0
3: 200061A0
... (until 31)
Any idea ? Or am I on the wrong track and the issue is somewhere else in the code ?