2018-02-03 05:54 AM
For a USB CDC device application I use STM32CubeF4.
It works very well now.
Now I need a second CDC channel, which paralel the 1st CDC transmits a data stream to the host.How do I create a second USB CDC instance with Cube and how is it used?I have set the parameter 'USBD_MAX_NUM_INTERFACES (Maximum number of supported interfaces)' to 2 in Cube, but this has changed nothing in the generated files except for the '&sharpdefine USBD_MAX_NUM_INTERFACES 2' in usb_conf.h.
USBD_MAX_NUM_INTERFACES is used only once in the file usbd_ctlreq.c throughout the project.Is this even possible with Cube / HAL or do I have to venture the new adventure and switch to the ARM middleware library?There is in the description 'The USB Component allows multiple instances of the CDC class.'
In the STM Cube documentation I did not find any indication that multi instanc CDCe is supported or not.#cube-stm32f4-multi-instance-usb-cdc-device #stm32f4-multi-instance-usb-cdc-device*2018-08-09 07:37 PM
Sorry, bumping old zombie unanswered questions off my feed
2018-11-15 07:01 AM
I have the same question. If I change the number USBD_MAX_NUM_INTERFACES from 1 to 2 I still have one /dev/ttyACM0. Is it possible to run more then one with different product identifiers ? Who from ST can support this topic ?
2022-09-05 07:16 AM
Same problem for me today with a STM32L072 device...
2022-09-05 04:11 PM
@MSoli.2 IIRC this is a Cube startup generator deficiency. To have two or more instances of same device class you need to manually add & initialize the 2nd class "object" (struct).
2022-09-05 11:42 PM
I had seen that the post was particularly old and I was hoping this aspect had been improved.
Do you have an example to suggest that it is based on the code generated by CubeMX?
2022-09-06 03:18 PM
Sorry, my mistake. My reply relates to use of some class on two USB controller instances, not to a composite device. For a composite, more complex change is needed: replace set of interface state fields in the "class handle" with arrays of these fields per-interface.
In the class request handlers, check if the request is to interface, if so, retrieve the interface index. Sorry I don't have example for CDC.
For a "serious" project the best option is using a good supported (commercial) USB library.
2024-01-18 10:31 PM
Hi,
it is a shame that CubeMX does not support a combination of several device classes. After one day of searching examples i found a "software pack" for CubeMX:
alambe94/I-CUBE-USBD-Composite: Create STM32 USB Composite devices with ease. (github.com)
ST, please support this project and promote it, so we all can save lifetime!
I use:
CubeMX 6.10.0
CubeIDE 1.14.0
Processor: STM32F407VGT