2023-07-11 05:10 PM
If the Sub device is connected as below, the USB CDC TX output of the Main device does not work.
Please refer to the information below.
I don't know the reason.
2023-07-12 04:37 AM
If you are not a developer, you cannot solve such complex problems...
2023-07-12 05:18 AM - edited 2023-07-12 05:20 AM
When "doesn't work", is "main mcu" still visible in the USB Treeview on PC? Does the PC poll this mcu through USB, are there PID IN packets on the bus towards this mcu?
If both answers are yes, then it's a software problem in the mcu - debug as usually - observe the behaviour, observe the related hardware registers, trace relevant code execution paths (e.g. by toggling one or more pins), formulate hypotheses and write test code which confirms or rejects these.
JW
2023-07-12 03:59 PM - edited 2023-07-12 04:01 PM
Thank you for responding. I am a system engineer. (H/W)
※ This problem occurs intermittently. But sometimes it happens frequently.
When "doesn't work", is "main mcu" still visible in the USB Treeview on PC?
> In the PC device manager, the Com port of the main MCU is maintained.
Does the PC poll this mcu through USB, are there PID IN packets on the bus towards this mcu?
>When the PC S/W is turned on and is normal, PID IN packets come at 50us intervals. (PC S/W is simply connected to the port)
When a problem occurs, it seems that only frame sync is output at 1 ms intervals. (I'll check it again.)
However, when a problem occurs, when PC S/W outputs TX data (USB CDC RX), the main MCU receives RX data and operates normally.
And after the operation, if the response is sent through USB CDC TX, it was confirmed that it enters the buffer.
However, no data is actually sent to the PC.
2023-07-12 11:17 PM
USB is a polled bus, so if the host does not issue PID IN packets, there is no way the connected device can send data.
Why does that happen I don't know, maybe there is a USB reset at the moment the other device is connected, and while Tera Term is quite aggressive in reconnecting, maybe that fails somehow. I am just speculating here. Try capturing events on the USB bus at the moment of connection of the other device and try to decipher from there what has happened.
JW
2023-07-12 11:39 PM
Just in case, I'll just remind that ST's parody of an USB stack works purely from interrupts. That means, if some of it's API is called from non-interrupt code or an interrupt of a different priority level than USB interrupts without properly disabling USB or all interrupts, then the code is broken. The solution is simple - toss out that broken bloatware and take something, that is developed by competent developers, like TinyUSB.
2023-07-14
09:07 AM
- last edited on
2023-07-20
02:34 AM
by
Lina_DABASINSKA
Hi @seonmin ,
You can provide us some more information to help understand the issue: