You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But that does not add proper descriptors and endpoint addresses. I solved this by comparing with NXP device descriptors.
The changes made to get two devices listed as ttyACM1 and ttyACM2 are:
uint8_t USBD_FrameWork_AddToConfDesc(USBD_DevClassHandleTypeDef *pdev, uint8_t Speed,
uint8_t *pCmpstConfDesc)
{
.
.
.
switch (pdev->tclasslist[pdev->classId].ClassType)
{
#if USBD_CDC_ACM_CLASS_ACTIVATED == 1
case CLASS_TYPE_CDC_ACM:
/* Find the first available interface slot and Assign number of interfaces */
interface = USBD_FrameWork_FindFreeIFNbr(pdev);
pdev->tclasslist[pdev->classId].InterfaceType = interface; //! Assign missing interface number.
pdev->tclasslist[pdev->classId].NumIf = 2U;
}
And the address was incremented by InterfaceType.
static void USBD_FrameWork_AssignEp(USBD_DevClassHandleTypeDef *pdev,
uint8_t Add, uint8_t Type, uint32_t Sze)
{
uint32_t idx = 0U;
/* Find the first available endpoint slot */
while (((idx < (pdev->tclasslist[pdev->classId]).NumEps) && \
((pdev->tclasslist[pdev->classId].Eps[idx].is_used) != 0U)))
{
/* Increment the index */
idx++;
}
/* Configure the endpoint */
uint8_t address = Add + pdev->tclasslist[pdev->classId].InterfaceType;
pdev->tclasslist[pdev->classId].Eps[idx].add = address;
pdev->tclasslist[pdev->classId].Eps[idx].type = Type;
pdev->tclasslist[pdev->classId].Eps[idx].size = (uint16_t) Sze;
pdev->tclasslist[pdev->classId].Eps[idx].is_used = 1U;
}
This fixed the issue. Now I see two VCOMs.
[ +0.300216] usb 1-4.3.4: new full-speed USB device number 89 using xhci_hcd
[ +0.190420] usb 1-4.3.4: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00
[ +0.000005] usb 1-4.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ +0.000002] usb 1-4.3.4: Product: STM32 Virtual ComPort
[ +0.000002] usb 1-4.3.4: Manufacturer: STMicroelectronics
[ +0.000001] usb 1-4.3.4: SerialNumber: CDC_ACM001
[ +0.016028] cdc_acm 1-4.3.4:1.0: ttyACM1: USB ACM device
[ +0.000428] cdc_acm 1-4.3.4:1.2: ttyACM2: USB ACM device
Hello all,
I am trying to add two virtual COM ports on STM32WB5MMHGx device. The initial code is based out of STM32Cube, example: Ux_Device_CDC_ACM.
I initially added this piece of code to register the class.
Memory pool and USB stack sizes were increased so that this registration process success.
That did not show up as two ACM devices on Linux. After digging around, I found that there is a bug in the ux_device_descriptors.c.
This piece of code is needed to enumerate and add two classes.
But that does not add proper descriptors and endpoint addresses. I solved this by comparing with NXP device descriptors.
The changes made to get two devices listed as ttyACM1 and ttyACM2 are:
And the address was incremented by InterfaceType.
This fixed the issue. Now I see two VCOMs.
Also, I added the addresses to the init function:
I am not sure if the above is configuration is correct. I have simply followed the pattern.
Issue:
When two CDC ACM classes are added to device_framework_full_speed, I get gibberish on the COM port.
Simply removing CLASS_TYPE_CDC_ACM from UserClassInstance makes a single COM port and UART work as per the initial example.
I am definitely missing something. Can anyone help me out?
Here is a link to the complete project on GitHub.
Best regards,
Navin
The text was updated successfully, but these errors were encountered: