USB CDC ACM and 64 bytes transaction

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
russian
Posts: 365
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

Re: USB CDC ACM and 64 bytes transaction

Postby russian » Sun Oct 27, 2024 6:26 pm

Thank you for looking into this!
http://rusefi.com/ - electronic fuel injection

Dron_Gus
Posts: 17
Joined: Wed Apr 22, 2020 1:03 am
Has thanked: 2 times
Been thanked: 3 times

Re: USB CDC ACM and 64 bytes transaction

Postby Dron_Gus » Mon Oct 28, 2024 10:33 pm

Giovanni wrote:Hi,

Could you post your changes?

Hi.

Sorry for late reply.

Attached. Did not have time to clean-up it.

With this set of patches I see no delays with 64 bytes OUT transaction. As soon as I do dd to ACM in one terminal I see "received 64" in minicom (I'm using SD for debug messages).
But 64, 128 .. bytes transaction is still marked timeout in sniffer. 63 and 65 bytes transactions are not.
Screenshot from 2024-10-29 00-32-01.png

Screenshot from 2024-10-29 00-32-38.png
Attachments
patches.zip
(7.01 KiB) Downloaded 17 times

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

Re: USB CDC ACM and 64 bytes transaction

Postby Giovanni » Tue Oct 29, 2024 8:16 am

Hi,

Is that an USB analyzer that you use for those logs or some kind of SW?

Giovanni

Dron_Gus
Posts: 17
Joined: Wed Apr 22, 2020 1:03 am
Has thanked: 2 times
Been thanked: 3 times

Re: USB CDC ACM and 64 bytes transaction

Postby Dron_Gus » Tue Oct 29, 2024 10:47 am

Giovanni wrote:Hi,

Is that an USB analyzer that you use for those logs or some kind of SW?

Giovanni

Hi
I rented a TotalPhase Beagle 480 https://www.totalphase.com/products/beagle-usb480/ .
Initial bug hunting was done with WireShark under Linux.

User avatar
FXCoder
Posts: 393
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 184 times
Been thanked: 131 times

Re: USB CDC ACM and 64 bytes transaction

Postby FXCoder » Wed Oct 30, 2024 1:16 am

FYI from Great Scott...
cynthion

In addition to the list of suppliers...
Mouser

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

Re: USB CDC ACM and 64 bytes transaction

Postby Giovanni » Wed Oct 30, 2024 5:04 am

Hi,

Thanks Bob, I was just searching for something like this, usually analyzers are not that cheap.

Giovanni

Dron_Gus
Posts: 17
Joined: Wed Apr 22, 2020 1:03 am
Has thanked: 2 times
Been thanked: 3 times

Re: USB CDC ACM and 64 bytes transaction

Postby Dron_Gus » Mon Nov 04, 2024 10:32 am

Seems we found a workaround for our case: https://github.com/rusefi/ChibiOS/pull/48 .
At least I do not see any communication freeze any more. 64-bytes writes are still marked red/timeout, but this does not affect anything (I hope)

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

Re: USB CDC ACM and 64 bytes transaction

Postby Giovanni » Mon Nov 04, 2024 1:45 pm

Thanks for confirming, will give it a try ASAP.

Giovanni

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

Re: USB CDC ACM and 64 bytes transaction

Postby Giovanni » Wed Nov 13, 2024 11:28 am

Hi,

What I am seeing using the USB_RAW demo on an STM32F746:

Reading data from the demo always works using:

Code: Select all

dd if=/dev/ttyACM1 of=/dev/null bs=512 count=1000


It works regardless of the count and block size.

Writing data to the demo only works for packets up to 64 bytes, anything bigger fails and DD is stuck.....

Code: Select all

dd if=/dev/zero of=/dev/ttyACM1 bs=64 count=1000


So far I have not an explanation for this, adding the retry to the ISR does not help.

Giovanni

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

Re: USB CDC ACM and 64 bytes transaction

Postby Giovanni » Sat Nov 16, 2024 9:45 am

Hi,

Wanted to share some strangeness. I am using Linux Mint as host.

If I start an USB_RAW demo any attempt to use "dd" or "stty" or even "cat" to send/receive data causes the command to hang, presumably on open() of the port (/dev/ttyACMx).

If I 1st open the port using the Eclipse terminal it works (is it doing anything special????), I see the data in the terminal and afterward also dd, stty and cat work as expected. I verified this using both OTGv1 on STM32F746 and USBv2 on STM32G4, this makes me thing that it is not a driver problem because those two drivers are entirely different. Any idea about what could cause this? I added a rule to the "modem manager" to make it not interfere with those ports but no luck.

This is very repeatable.

The second problem is specific of OTGv1, using "dd" with any buffer size greater that 64 does not work, it works with USBv2, this is likely a separate issue.

Adding the retry loop to the ISR made no difference for both issues.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest