Datasheet
p += USB_DESCRIPTOR_LENGTH_CDC_ABSTRACT;
p[3] = g_CdcVcomCicInterfaceIndex[i];
p[4] = g_CdcVcomDicInterfaceIndex[i];
p += USB_DESCRIPTOR_LENGTH_CDC_UNION_FUNC;
#if USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE
p[2] = g_CdcVcomCicInterruptInEndpoint[i] | (USB_IN <<7);
p += USB_DESCRIPTOR_LENGTH_CDC_CIC_INTERRUPT_ENDPOINT;
#endif
/* data interface descriptor */
p[2] = g_CdcVcomDicInterfaceIndex[i];
/* bulk in endpoint descriptor */
p += USB_DESCRIPTOR_LENGTH_INTERFACE;
p[2] = g_CdcVcomDicBulkInEndpoint[i] | (USB_IN <<7);
/* bulk out endpoint descriptor */
p += USB_DESCRIPTOR_LENGTH_ENDPOINT;
p[2] = g_CdcVcomDicBulkOutEndpoint[i] | (USB_OUT <<7);
}
}
Adding CDC class descriptors manually is also an error-prone step. The array length is very long when 15 VCOM descriptors
are used. This dynamic method makes it easy to configure descriptors. After completing the above four optimizations, user can
set the number of VCOMs through the macro USB_DEVICE_CONFIG_CDC_ACM, and user can also use the macro
USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE to determine whether to use the interrupt endpoint in the CIC interface.
7 Function Test
Two projects of MCUXpresso version for K32L2B3 are provided in the attachment to this application note. The first project is a
project that has not been optimized by the steps in section 6.3, and the second project is the optimized project. Similarly, two
similar projects were also provided for the K32L2A. Use the optimized project of K32L2B3 for functional testing:
Set the macro USB_DEVICE_CONFIG_CDC_ACM and the macro USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENDABLE to
a different value, then compile the project to download the program to the board, the results are as shown in Figure 11.
NXP Semiconductors
Function Test
USB to Multi VCOM on K32L2 Series MCU, Rev. 0, November 2019
Application Note 23 / 25