Configuration of the USB Device CDC (NCM) Class in µVision.
Configuration of the USB Device CDC (NCM) Class in µVision.
This configuration file defines:
- The assignment of the CDC class to the USB Device instance.
- USB Endpoint assignments for the CDC class with parameters for Full/Low-speed and High-speed communication.
- Class Settings for the Interface Descriptor.
These settings are used to create the Interface Descriptor and Endpoint Descriptor of the related USB Device Class. It is important that the settings match the application specific behavior in the related C source file USBD_User_CDC_NCM_n.c.
CDC Class Configuration File
The USB Device CDC Class configuration file USBD_Config_CDC_n.h contains the following settings:
- Assign Device Class to USB Device # selects USB Device that is used for this Device Class instance.
- Communication Class Subclass specifies the model used by the CDC class. Select the
Network
Control
Model
.
- Interrupt Endpoint Settings
- Interrupt IN Endpoint Number sets the number of the endpoint to be used. Conflicting settings are flagged by compile-time error messages.
- Endpoint Settings
- Full/Low-speed (High-speed disabled): These parameters apply when High-speed is disabled in USBD_Config_n.c:
- Maximum Endpoint Packet Size (in bytes) specifies the physical packet size used for information exchange.
- Endpoint polling Interval (in ms) specifies the frequency of requests initiated by USB Host for getting a notification.
- High-speed: These parameters apply when High-speed is enabled in USBD_Config_n.c:
- Maximum Endpoint Packet Size (in bytes) specifies the physical packet size used for information exchange.
- Endpoint polling Interval (in ms) specifies the frequency of requests initiated by USB Host for getting a notification.
- Additional transactions per microframe improve communication performance.
- Bulk Endpoint Settings
- Bulk IN Endpoint Number sets the number of the endpoint to be used. Conflicting settings are flagged by compile-time error messages.
- Bulk OUT Endpoint Number sets the number of the endpoint to be used. Conflicting settings are flagged by compile-time error messages.
- Endpoint Settings
- Full/Low-speed (High-speed disabled): These parameters apply when High-speed is disabled in USBD_Config_n.c:
- Maximum Endpoint Packet Size (in bytes) specifies the physical packet size used for information exchange.
- Maximum NAK Rate specifies the interval in which Bulk Endpoint can NAK.
- High-speed: These parameters apply when High-speed is enabled in USBD_Config_n.c:
- Maximum Endpoint Packet Size (in bytes) specifies the physical packet size used for information exchange.
- Maximum NAK Rate specifies the interval in which Bulk Endpoint can NAK.
- Communication Class Settings
- Communication Class Interface String is used to create USB Descriptors.
- Data Class Interface String is used to create USB Descriptors.
- Abstract Control Model Settings are only used for the Abstract Control Model sub-class.
- Network Control Model Settings
- MAC Address String specifies the 48-bit Ethernet MAC address of the device.
- Ethernet Statistics specifies the Ethernet statistic functions that are supported. These need to be implemented by the user in the user code template file.
- Maximum Segment Size specifies the maximum segment size (MSS) that the Ethernet device can support.
- Multicast Filtering specifies multicast filtering type.
- Number of Power Filters specifies the number of pattern filters that are available to wake-up the USB Host.
- Network Capabilities specifies which functions are supported.
- SetCrcMode/GetCrcMode
- SetMaxDatagramSize/GetMaxDatagramSize
- SetNetAddress/GetNetAddress
- SetEthernetPacketFilter
- NTB Parameters specifies the NTB parameters that are reported by the USBD_CDCn_NCM_GetNtbParameters function.
- NTB Formats Supported specifies the NTB formats that are supported.
- 16-bit NTB (always supported)
- 32-bit NTB
- IN Data Pipe
- Maximum NTB Size specifies the maximum IN NTB size in bytes.
- NTB Datagram Payload Alignment Divisor specifies the divisor used for IN NTB Datagram payload alignment.
- NTB Datagram Payload Alignment Remainder specifies the remainder used to align input datagram payload within the NTB.
- NDP Alignment Modulus in NTB specifies NDP alignment modulus for NTBs on the IN pipe.
- OUT Data Pipe
- Maximum NTB Size specifies the maximum OUT NTB size in bytes.
- NTB Datagram Payload Alignment Divisor specifies the divisor used for OUT NTB Datagram payload alignment.
- NTB Datagram Payload Alignment Remainder specifies the remainder used to align output datagram payload within the NTB.
- NDP Alignment Modulus in NTB specifies NDP alignment modulus for NTBs on the OUT pipe.
- Raw Data Access API enables or disables Raw Data Access API.
- IN NTB Data Buffering specifies buffering used for sending data to USB Host if Raw Data Access is disabled.
- OUT NTB Data Buffering specifies buffering used for receiving data from USB Host if Raw Data Access is disabled.
- OS Resources Settings
- Communication Device Class Interrupt Endpoint Thread Stack Size is used for memory allocation in the USB component.
- The default Communication Device Class Interrupt Endpoint Thread priority is osPriorityAboveNormal. This priority can be changed by changing USBD_CDCn_INT_THREAD_PRIORITY define in this configuration file. This priority needs to be high enough so that USB Stack can react to USB events in a timely manner. Due to this requirement it is recommended to keep this setting at default.
- Communication Device Class Bulk Endpoints Thread Stack Size is used for memory allocation in the USB component.
- The default Communication Device Class Bulk Endpoints Thread priority is osPriorityAboveNormal. This priority can be changed by changing USBD_CDCn_BULK_THREAD_PRIORITY define in this configuration file. This priority needs to be high enough so that USB Stack can react to USB events in a timely manner. Due to this requirement it is recommended to keep this setting at default.