Host interval configuration #3706
Replies: 4 comments
-
|
Had a quick look at the USB device data using "USB Device Tree Viewer", it seems this mouse has an interval of 10ms, now I am confused. bLength : 0x07 (7 bytes) |
Beta Was this translation helpful? Give feedback.
-
|
A bit more info, the reto computer accepts input every 32ms for a mouse. I assume TinyUSB puts USB device reports onto a queue/buffer somewhere in the SDK. I think I need to update the code in TinyUSB that adds the USB device reports to the buffer so that it only adds a report every 32ms and discards the reports in between the 32ms time interval. Am I on the right track, could someone help me by pointing me in the right direction please? Thanks |
Beta Was this translation helpful? Give feedback.
-
|
When does "tuh_hid_report_received_cb" fire? Does it fire as soon the USB mouse sends a report? I have added code to "tuh_hid_report_received_cb" to write each report to my own ring buffer. I then read from that buffer from my main() function, but the writing to the ring buffer and the reading from the ring buffer still seems to work synchronously, should writing and reading be happening asynchronously ? So for example the buffer should be added to every 10ms, and read from every 30ms, so I should see 3 writes to every read. I see 1 write and 1 read so I'm confused. |
Beta Was this translation helpful? Give feedback.
-
|
Think I may have worked it out, tuh_task() was in the same while loop as the code that processed each report. I think tuh_task() initiates the device to send a report. Therefore tuh_task() only ran after the last device report was processed which took 32ms. I moved tuh_task() into a while loop on another core so that it runs independently of the code that processes each report. Now tuh_task() runs unrestricted and device reports generated and buffered ready to be read every 32ms. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using tinyusb as an interface between USB hid devices (mouse and keyboard) and a retro computer using a pi Pico.
I'm using tinyusb too act as a host, I then convert the device report into a signal the retro computer can handle and send that to the retro computer.
When using a basic HP USB mouse, I noticed if I move the mouse quickly, the cursor on the retro computer moves and continues to move for a few seconds after I have stopped moving the mouse.
Could this be caused because the polling interval of the usb mouse is too high for the retro computer to keep up with? A USB mouse reports how far it has moved since the last report, unrestricted when I moved the mouse quickly the cursor on the retro computer just shuddered, limiting the range of movement reported to the retro computer to 0-30 instead of 0-127 eliminates this, but there is still lag on fast movement.
Is the problem the interval being reported from the mouse is too high? It seems I need to an interval every 8ms.
Is this configurable in tinyusb?
Any help appreciated.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions