Hi,
I have created a USB hub design based on TUSB8041A that works well. The HUB shows up on the USB bus and when I connect USB High-speed devices to it, they show up and work as expected at 5Gbit/s. So far, all good.
In the design, I also need a "keyboard" that trigger certain keystrokes when hardware buttons are pressed. This is implemented in the form of a STM32F103C8T6 with USB HID firmware running at USB Full-speed. I have tested the "keyboard" part of this design separately in the form of a BluePill board on a breadboard (see picture) and in a minimized form with the STM32F103C8T6 soldered onto a breakout board with just a crystal/caps + a single 1.5k pullup on the D+ line (see picture). Both these designs work perfectly. On any computer (Windows, Ubuntu, OSX) they just show up as a keyboard and work. Still all good.
The problem is that when I move the STM32F103C8T6 design onto the same board as the USB Hub, it no longer works. Not only that, when the STM32F103C8T6-keyboard fails, it will often pull down the TUSB8041A HUB as well. A Unix log example of what happens can be found here: https://zerobin.no/?d14cd1e3e778e8e8#B8SyCLgnBcssc163t42Lq48GeBcvJP3EoHCMtx4bPF7Z
If I cut the traces between the HUB and the STM32F103C8T6, the HUB works normally. If I then solder in GND, DP and DM of either the Bluepill Breadboard test or the STM32F103C8T6 Breakout board, it will work flawlessly. No errors whatsoever. Always comes up and works.
So - my question is then - what will cause a more ideally implemented version of the same device (STM32 on same PCB with differentially matched traces) to fail, whereas the very non-ideal design (with terrible quality wires of differing lengths with poor breadboard connections, soldered onto the USB HUB board) works flawlessly? Are there timing requirements for the TUSB8041A that will break if a USB device is implemented on the same PCB? Could the connection be "too good"? Can it be a timing issue? (the STM32F103C8T6 device will be starting a few milliseconds before the TUSB8041A, since only the hub has timing requirements)
Regarding communications: Testing with a scope reveals that the STM device will only occasionally respond to the reset sent from the HUB. The HUB sends a reset, and then the STM responds only occasionally. I would say this is the fault of the STM if it wasn't for the tests showing that the same device will work great if it's not on the actual PBC (but rather in a breadboard). Here is a video showing the signals on DP/DM https://www.youtube.com/watch?v=ZxSBaxUTLRI
I've tried finding the solution for many days and nights now and I have exhausted my idea pool. I desperately need help from someone with more experience.
(Enclosed schematic + pictures of breadboard setups and PCB with STM)