two USB CDC with shell - only one working

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

Moderators: RoccoMarco, barthess

robert_o
Posts: 48
Joined: Fri Feb 17, 2017 11:25 pm
Has thanked: 1 time
Been thanked: 5 times

two USB CDC with shell - only one working

Postby robert_o » Fri Jul 21, 2023 6:55 pm

Hello everybody.
I am trying to get the USB_CDC_IAD from the testhal dir to work on my F411CE board. I already got it working on a F303 Nucleo (i had to port it from Discovery F303 to Nucleo64 F303) and it works as it should. I have two shells in two ttyACM ports.
I use a "Blackpill" board with a F411CE chip and made a board file and a mcuconf file.
I get two ttyACM ports in linux (ttyACM0 and ttyACM1), i can open both with picocom (picocom /dev/ttyACM0) and i can connect with the board.
On ttyACM0 i get the shell prompt, but on ttyACM1 i get nothing. I can type but i get nothing back, no echo, but the port stys open and the shell on ttyACM0 works fine.
"threads" on ttyACM0 shows:
threads.png
.

I also checked if i may be got a fake F411CE and used linker script and clock settings from the F401CC but no luck.

It just seems i can get any data through the second channel.
Anybody have any ideas?
It would be much appreciated, i am sitting on this since three days.

-robert.

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

Re: two USB CDC with shell - only one working

Postby Giovanni » Fri Jul 21, 2023 7:10 pm

Hi,

I never tried it on the F4, I would look into endpoint numbers, F3 and F4 use different USB peripherals.

Giovanni

robert_o
Posts: 48
Joined: Fri Feb 17, 2017 11:25 pm
Has thanked: 1 time
Been thanked: 5 times

Re: two USB CDC with shell - only one working

Postby robert_o » Fri Jul 21, 2023 8:02 pm

Thank you for your quick answer.
I additionaly tested a Nucleo F401 and a F411RE board. Both show the same result.
I use the USB_FS NOT the HS because the F401 and the F411 don't have it. So i assumed it is the same as the F3, but i'll check.

I am quite new to USB.

thanks,
robert.

robert_o
Posts: 48
Joined: Fri Feb 17, 2017 11:25 pm
Has thanked: 1 time
Been thanked: 5 times

Re: two USB CDC with shell - only one working

Postby robert_o » Fri Jul 21, 2023 8:30 pm

I just looked at the Reference Manuals of the F303 and the F411 and i don't even know where to look.
The USB FS Peripherals are different because the F411 has OTG Feature which the F303 hasn't.
I am lost.

-robert

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

Re: two USB CDC with shell - only one working

Postby Giovanni » Fri Jul 21, 2023 8:52 pm

Make sure the same endpoint number is not used for IN and OUT endpoints.

Giovanni

robert_o
Posts: 48
Joined: Fri Feb 17, 2017 11:25 pm
Has thanked: 1 time
Been thanked: 5 times

Re: two USB CDC with shell - only one working

Postby robert_o » Fri Jul 21, 2023 9:05 pm

I think i found the problem.
Quote:
"It's worth noting that CDC requires 2 IN and 1 OUT endpoints, so the working with multiple CDC devices depends really on the USB instance you are using (FS or HS).Within the OTG_FS we have 3 IN / 3 OUT endpoints, so you can only have one CDC. Otherwise, within the OTG_HS we have 5 IN / 5 OUT endpoints, so you can have two CDCs."
But in another post i found:
Quote:
" FS: control endpoint + 3 bidirectional endpoints (4 in and 4 out)
HS: control endpoint + 5 bidirectional endpoints (6 in and 6 out) FS: 1 CDC HS: 2 CDC If you are not interested on a USB certification, you can have FS: 2 CDC HS: 4 CDC The windows driver do not actually use the interrupt endpoint, it just polls the device. You can use the same interrupt endpoint for all the CDC devices. However, shared interrupt endpoint is not described on the official CDC documents, I think that you will not be able to get your device USB certified if you share the same endpoint."

I don't know if there is a chance to get this working with shared interrupt anywhere especially on linux.
So i guess it just doesn't work

--robert

robert_o
Posts: 48
Joined: Fri Feb 17, 2017 11:25 pm
Has thanked: 1 time
Been thanked: 5 times

Re: two USB CDC with shell - only one working

Postby robert_o » Fri Jul 21, 2023 10:01 pm

Just one thought:
isn't it possible to create an additional UNIdirectional ttyACM?
From an endpoint count it should work:
"fullsize" ttyACM: 2-IN, 1-OUT
"small" ttyACM 1-IN, 1-OUT
total: 3-IN, 2-OUT which should work. The small tty can be used for uploading data from the PC (OUT is seen from Host side).

How to configure is beyond my capabilities.

good night.
-robert

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

Re: two USB CDC with shell - only one working

Postby Giovanni » Sat Jul 22, 2023 6:09 am

Hi,

You need to change endpoint numbers in usbcfg.c, there are definitions there, then you need to change numbers also in descriptors and that is the complex part.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 12 guests