stm32 usb device dual
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-28 09:52 PM
Hello. I'm using EVM board with STM32F407ZGT.
I set up the USB as below to use it as a USB Device. (CDC)
But only one COM port can be found in the device manager on the PC.
I want to know if I can't set 2 usb device or if it's a problem with setting.
Please help me!!
Solved! Go to Solution.
- Labels:
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-29 04:35 AM
Hello @DJung.3
You need to register two instances with USBD_RegisterClassComposite.
/* Init Device Library */
USBD_Init(&USBD_Device, &COMPOSITE_Desc, 0);
/* Register CDC class first instance */
USBD_RegisterClassComposite(&USBD_Device, USBD_CDC_CLASS, CLASS_TYPE_CDC, CDC_EpAdd_Inst1);
/* Register CDC class second instance */
USBD_RegisterClassComposite(&USBD_Device, USBD_CDC_CLASS, CLASS_TYPE_CDC, CDC_EpAdd_Inst2);
/* Add CDC Interface Class */
if (USBD_CMPSIT_SetClassID(&USBD_Device, CLASS_TYPE_CDC, 0) != 0xFF)
{
USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops);
}
/* Add CDC Interface Class */
if (USBD_CMPSIT_SetClassID(&USBD_Device, CLASS_TYPE_CDC, 1) != 0xFF)
{
USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops);
}
/* Start Device Process */
USBD_Start(&USBD_Device);
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
I'm out of offce with limited access to my emails.
Happy New Year!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-29 04:35 AM
Hello @DJung.3
You need to register two instances with USBD_RegisterClassComposite.
/* Init Device Library */
USBD_Init(&USBD_Device, &COMPOSITE_Desc, 0);
/* Register CDC class first instance */
USBD_RegisterClassComposite(&USBD_Device, USBD_CDC_CLASS, CLASS_TYPE_CDC, CDC_EpAdd_Inst1);
/* Register CDC class second instance */
USBD_RegisterClassComposite(&USBD_Device, USBD_CDC_CLASS, CLASS_TYPE_CDC, CDC_EpAdd_Inst2);
/* Add CDC Interface Class */
if (USBD_CMPSIT_SetClassID(&USBD_Device, CLASS_TYPE_CDC, 0) != 0xFF)
{
USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops);
}
/* Add CDC Interface Class */
if (USBD_CMPSIT_SetClassID(&USBD_Device, CLASS_TYPE_CDC, 1) != 0xFF)
{
USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops);
}
/* Start Device Process */
USBD_Start(&USBD_Device);
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
I'm out of offce with limited access to my emails.
Happy New Year!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-13 04:26 AM
Hello, for a USB composite device with two CDC, both CDC eventually call the same CDC_Init_FS function and thus share a single buffer. When both CDCs are transmitting data simultaneously, is there a risk of data loss due to sharing the same buffer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-13 05:24 AM
Hi @Mrli110
Have you checked this article How to implement a dual CDC ACM USB device using t... - STMicroelectronics Community If still having issues, I suggest you starting a new thread.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
I'm out of offce with limited access to my emails.
Happy New Year!