Repository navigation
Replies: 1 comment 6 replies
|
@HiFiPhile, Why discussion? I report a bug of TinyUSB itself that in its default way initialises the USB incorrectly. And I want to fix the bug at the TinyUSB itself so it will initialise the device correctly from out of box. Without the necessary to run my workaround function. |
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Operating System
Others
Commit SHA
ad54f72
Board
STM32F103C8T6 Bluepill
Firmware
3rdparty/tinyusbbeing it like a submodule).Sources/main.cthe calling of theUSB_init_workaround();function (on a moment of this issue creation it was a line 347) to make the bug being reproducible.Sources/usb/tusb_dev/fsdev_common.candSources/usb/tusb_dev/dcd_stm32_fsdev.cwith paths at the3rdparty/tinyusb. These files are my unfinished attempt to make a mod that will initalise endpoints correctly, but it doesn't helps.What happened ?
I debbuged thing for a while and I found the true issue and I attempting to fix is truely, but first I want to report everything first.
Okay so, it seems the thing incorrectly initialises endpoints. And what happens? Using my firmware and the TinyUSB thing I attempting to simulate the Nintendo Switch Pro Controller gamepad using it. It successfully passes the basic USB handshake with sending things like device description, product, vendor, serial, etc. However, once a time to send the first HID report, it doesn't reaches the host. Instead of receiving the HID report, the host receives the IRQ status -75 (EOVERFLOWN) as an error. It is NOT an overflow at all. I attempted for a test reasons change the HID report size in my code to way smaller, and it still the same. And ye, after this moment, on device side I just receive the "SUSPEND" command from the host, AND, on the device side the thing is treated like it was SUCCESSFULLY sent the thing. So ironic. As the error occurrs on the host side. And, it's absolutely no matter who the host is, Linux PC, Windows PC, Nintendo Switch, mobile phone with USB OTG, the result is absolutely same.
HOWEVER, I found a WEIRD case: It starts to work correctly just if I install first a simple HID keyboard+mouse demo from another project that 100% works. And quickly after that, I install my gamepad firmware. But after powering off the board and attempt to run the firmware again results the behaviour above.
AND, I found a way to "fix" it by taking USB initialisation and endpoints addresses assignment code from that working keyboard+mouse demo and wrapping them into "USB_init_workaround()" function that implemeted here in
Sources/usb/usb_extra.c.And after execution if this ugly workaround, the board works just fine.
How to reproduce ?
dmesg -wto watch for events.Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
Here I made my own logs and USB captures before fixing: https://github.com/Wohlstand/NXUSB-STM32-Firmware/tree/main/reports
Files with "-bad" suffix are resulted from errors.
Screenshots
There are some result of device initialisation that goes wrong:

I have checked existing issues, discussion and documentation
All reactions