USB serial disconnects F4 every 15 minutes exactly, H7 every 20 seconds exactly.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

User avatar
russian
Posts: 364
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

USB serial disconnects F4 every 15 minutes exactly, H7 every 20 seconds exactly.

Postby russian » Sun Feb 13, 2022 4:16 am

I have something really weird going on only on a very specific Windows device and I am looking for fresh ideas. I am pretty sure the problem is NOT with ChibiOS just needed a place to vent/share.

We use USB serial to send data from our stm32 devices to commercial monitoring software in which I have full trust, we also have our own simpler monitoring software. On my older laptop and my older desktop I get hours of reliable USB serial communication at about 20Kb per second, 100Hz request of 200 bytes of payload

On the "newest" dell laptop something really odd started to happen.

Stm32f4discovery connection gets lost every 15 minutes, that's once in every 90000-ish transmissions

Code: Select all

2/12/22 8:05:16 AM :Info: Re-establishing connection to: RS232: Port:COM4, Baud:115200
2/12/22 8:20:16 AM :Info: Re-establishing connection to: RS232: Port:COM4, Baud:115200
2/12/22 8:35:17 AM :Info: Re-establishing connection to: RS232: Port:COM4, Baud:115200
2/12/22 8:50:16 AM :Info: Re-establishing connection to: RS232: Port:COM4, Baud:115200
2/12/22 9:05:16 AM :Info: Re-establishing connection to: RS232: Port:COM4, Baud:115200
2/12/22 9:20:16 AM :Info: Re-establishing connection to: RS232: Port:COM4, Baud:115200


on the same laptop our device with stm32h7 looses connection every 20 seconds

Code: Select all

2/12/22 9:26:29 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200
2/12/22 9:26:50 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200
2/12/22 9:27:11 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200
2/12/22 9:27:32 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200
2/12/22 9:27:55 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200
2/12/22 9:28:16 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200
2/12/22 9:28:37 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200
2/12/22 9:28:58 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200
2/12/22 9:29:19 AM :Info: Re-establishing connection to: RS232: Port:COM16, Baud:115200


I am out of reasonable theories. I've already updated BIOS and other drivers. The 15 minute period is just too weird. Having a 60 times different frequency of error between discovery and H7 makes no sense. I've already started thinking about USB controller having power issues? Makes no sense.

Looking for moral support and ideas.
http://rusefi.com/ - electronic fuel injection

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: USB serial disconnects F4 every 15 minutes exactly, H7 every 20 seconds exactly.

Postby Giovanni » Sun Feb 13, 2022 7:05 am

Just random things to try:

- Put an USB hub between board and host and see if it makes a difference.
- Change systick frequency and see if it changes interval.
- Try without compiler optimizations.
- Try an USB connection without the whole application behind, just send some dummy data (try various rates).

Giovanni

electronic_eel
Posts: 77
Joined: Sat Mar 19, 2016 8:07 pm
Been thanked: 17 times

Re: USB serial disconnects F4 every 15 minutes exactly, H7 every 20 seconds exactly.

Postby electronic_eel » Sun Feb 13, 2022 12:29 pm

I would try to find out if it has to do something with the actual hardware of the laptop or with the windows drivers for it. To do that I would run Linux on the laptop and see if the communication there works or is also aborted after some time. I suggest SystemRescue for this as you can run it from a USB memory stick and don't have to install anything on your hard drive. Use the "copytoram" boot option to load everything into RAM so that reading from the USB memory stick doesn't change the USB access patterns that could be the cause for your problem.

If you need Windows software to make the communication work at all, you could install linux and run the windows in a virtual machine. You can then forward the usb device into the windows-vm. This would also allow you to use usbmon to create a full trace of the usb communication. If the problem also occurs when using the windows-vm, you'd have the data to investigate deeper.

If the error doesn't occur with linux, you could directly sniff the USB protocol on the wire with a logic analyzer. I guess this is using USB FullSpeed = 12 MBit/s (you'd need a special USB-PHY to get USB HighSpeed on a STM32F4). Fullspeed is well within the realm of common logic analyzers.

If you want even deeper USB analysis, I can recommend LUNA. It can sit between the device and host and proxy the requests. It can then sniff the full protocol even with HighSpeed and also modify the URBs in real time with an FPGA. It comes with a nice framework to configure the FPGA without requiring you to write full Verilog/VHDL from scratch. Unfortunately chip shortage means they can't ship them right now.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: USB serial disconnects F4 every 15 minutes exactly, H7 every 20 seconds exactly.

Postby Giovanni » Sun Feb 13, 2022 12:53 pm

This "LUNA" is very interesting, thanks.

Giovanni

User avatar
alex31
Posts: 379
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 62 times
Contact:

Re: USB serial disconnects F4 every 15 minutes exactly, H7 every 20 seconds exactly.

Postby alex31 » Sat Feb 19, 2022 7:46 pm

Is the new PC giving issues runs intel or amd ?

chipsets for amd zen3 are infamously known to have buggy USB, amd regularly publish bios update that only make things worse ...

The only solution for me was to add an USB3 pci card in the PC, but others has had success just using USB hub.

Alexandre


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 13 guests