USB Products
smxUSBD™
NXP ISSC USB Bluetooth Device drivers for Windows 7 x64. Install drivers automatically. DriverPack software is absolutely free of charge. USB Applications. NXP’s USB applications host and device libraries are provided with full source code and a wide range of examples. The MCUXpresso SDK default configurations include all of the necessary drivers and several example applications to help you take full advantage of USB features, and the MCUXpresso peripheral tools enable you to quickly and easily configure USB drivers for your. Install NXP ISSC USB Bluetooth Device driver for Windows 10 x86, or download DriverPack Solution software for automatic driver installation and update. Based on a driver from Freescale Semiconductor, Inc., additional thanks to Julian Horsch julian.horsch@aisec.fraunhofer.de for its contribution to the port. NOTE: USB armory users can automate Linux kernel compilation, along with the mxc-scc2 driver, using the Makefile (mxc-scc2 target) from its Debian base image repository.
USB Device Stack
smxUSBD is a robust USB device stack especially designed and developed for embedded systems. It is written in C, and can run on any hardware platform. While optimized for SMX®, smxUSBD can be ported to another RTOS or operate in a stand-alone environment.
smxUSBD is a full-featured USB device stack. It offers a clean, modular design that enables embedded developers to easily add USB device capabilities to their products. Normally this is done to permit connection to a PC or laptop in order to upload or download data, tables, code, or audio, or to control or configure devices. The smxUSBD device stack is offered separately from the smxUSBH host stack to reduce system cost and memory usage for projects not needing a host stack. It is compliant with the USB v2.0 specification (see www.usb.org).
For easy connectivity to a PC or laptop, smxUSBD includes mouse and keyboard function drivers, and the following are available separately: Audio, Device Firmware Upgrade (DFU), Ethernet over USB (ECM, NCM, RNDIS), Mass Storage, Media Transfer Protocol (MTP), Serial, and Video. Each is compatible with the corresponding Windows, Mac OS, and Linux USB driver. Thus, a device using smxUSBD does not require a custom W/M/L driver in order to connect to a PC or laptop. All that is needed is to decide on the connection type most appropriate for your device and to use the corresponding API for that device - see below.
Also available is a USB composite function driver framework, which allows a device to simultaneously look like two or more USB devices. The USB multi-port serial function driver allows a single USB connection to function as multiple serial ports (up to 1/2 the number of controller endpoints). This function driver comes with a custom Windows driver that supports it.
Layers
- Function Driver Layer provides USB functions to an application such as audio, mass storage, serial, and video.
- Device Core Layer provides the common USB device framework.
- Device Controller Driver Layer provides the interface to the selected USB device controller.
- Porting Layer provides service functions related to the hardware, OS, and compiler.
Function Drivers
The following sections describe each function driver and its API. The USB host is a Windows, Mac OS, or Linux system. See the smxUSBD User’s Guide for any limitations and implementation you must do for these.
Audio
The Audio function driver makes your device look like a sound card to the USB host. You can include a speaker and/or microphone in this audio device so you can playback and/or record sound. You can also integrate a MIDI port into your device so it can accept MIDI data. There is no need to install any driver or .inf file in Windows, Mac OS, or Linux to support this device but you may need to implement the sound device driver yourself, according to your system hardware and software environment.
sud_AudioIsConnected(port)
sud_AudioSendAudioData(port, pData, iLen)
sud_AudioGetAudioData(port, pData, iLen)
sud_AudioGetCurSpkSettings(port, pSettings)
sud_AudioGetCurMicSettings(port, *pSettings)
sud_AudioSendMIDIData(port, pData, iLen)
sud_AudioGetMIDIData(port, pData, iLen)
sud_AudioRegisterNotify(port, handler)
sud_AudioPackMIDIEvent(port, pData, pEvent)
sud_AudioUnpackMIDIEvent(port, pData, pEvent)
DFU
The DFU function driver allows updating the firmware in your device. The Windows operating system does not have a built-in driver for it, so you need to use a driver, such as the one provided by MDI or others that are commonly available. The DFU runtime function may be used as part of a composite device with other functions such as serial or mass storage. This is not a full firmware update solution. See the smxUSBD User’s Guide for details.
sud_DFUIsConnected()
sud_DFURegisterInterface (*pIF)
sud_DFUWriteDone (result, condition)
sud_DFUIsRuntimeMode()
Ethernet over USB
The Ethernet over USB function driver makes your device look like a network adapter to a Windows, MacOS, or Linux USB host. The host can communicate with this device via Ethernet data packets. Normally you need a TCP/IP stack on your device and use the APIs provide by this function driver to emulate an Ethernet device and add it to your network stack. This device has been integrated with smxNS, our TCP/IP stack. Then the host and your device can communicate with each other by TCP/IP with a USB cable instead of an Ethernet cable. One use of this is to allow configuring a device from the web browser on a host communicating with a web server on your device. This is especially useful if your processor has only a USB device controller and no Ethernet controller.
This driver supports CDC-ECM, CDC-NCM, and RNDIS for different host OSes. Windows supports RNDIS, and MacOS and Linux support ECM and NCM. RNDIS and either ECM or NCM can be enabled to support all three OSes, and the proper one is used at runtime when the device is plugged in. NCM supports packet aggregation.
int sud_NetIsPortConnected(port)
int sud_NetIsAggregationSupported(port)
int sud_NetWriteData(port, pBuf[], len[], packets)
void sud_NetRegisterPortNotify(port, handler)
void sud_NetSetEthernetAddr(port, pMACAddr)
HID Communication
The HID Communication function driver is useful for transferring small amounts of data. It is an alternative to the Serial function driver that does not require installing a driver or .inf file on Windows. It requires writing a special Windows application to communicate with it; a sample is provided.
sud_HIDIsConnected()
sud_HIDSendInput(*pDataBuf, size)
sud_HIDRegisterOutputNotify(handler)
Keyboard (Included)
The Keyboard function driver makes your device look like an HID keyboard to the USB host. It inputs key events to your PC.
sud_KBDInput(modifier, *key, count)
Mass Storage
The Mass Storage function driver makes your device look like a removable disk to the USB host. You can copy files to and from it.
sud_MSRegisterDisk(pDiskOper, lun)
Media Transfer Protocol (MTP)
The Media Transfer Protocol (MTP) function driver includes PTP support. It makes your device look like a digital still image device to the USB host. There is no need to install any driver or .inf file in Windows to support this device, but you may need to implement the file system interface (if not using smxFS) and the interface to get the properties of the files your device will support, such as the image width, height, etc.
MTP can also be used for general file transfer as an alternative to Mass Storage. Advantages are the ability to limit which files are accessed and that it is unnecessary to have two modes of operation to switch between local and USB access to the disk, to protect the file structure.
sud_MTPIsConnected(port)
sud_MTPRegisterInterface(pObjOper)
sud_MTPSendEvent(EventCode, iNumPar, *Par)
Mouse (Included)
The Mouse function driver makes your device look like an HID mouse to the USB host. It moves the mouse pointer on your PC.
sud_MouseInput(button, x, y, wheel)
Serial
The Serial function driver makes your device look like one or more COM ports to a Windows, Mac OS, or Linux USB host. You can use standard Win32 functions to communicate with the device, just like if it were connected to a real RS232 port. For the multi-port option, we provide a custom Windows USB serial driver, since the built-in Windows driver supports only one port. Our driver also allows using only 1/2 the number of endpoints, saving them for other uses.
sud_SerialIsPortConnected(port)
sud_SerialWriteData(port, pBuf, len)
sud_SerialDataLen(port)
sud_SerialReadData(port, pBuf, len)
sud_SerialSetLineState(port, iState)
sud_SerialGetLineState(port, piState)
sud_SerialGetLineCoding(port, pdwDTERate, pbParityType, pbDataBits, pbStopBits)
sud_SerialRegisterPortNotify(port, handler)
Video
The Video function driver makes your device look like a web camera to a Windows, Mac OS, or Linux USB host. There is no need to install any driver or .inf file in Windows to support this device but you may need to implement the camera sensor driver, and you may also need to customize the configuration of the driver for your real hardware features, such as the set of features your camera sensor will support.
sud_VideoIsConnected(port)
sud_VideoSendVideoData(port, pData, len)
sud_VideoGetVideoDataLen(port, len)
sud_VideoRegisterNotify(port, handler)
Composite Devices
smxUSBD allows creating a composite device. Such a device has multiple interfaces that are active at the same time using a single controller chip. For example, a composite device might combine serial and mass storage. See the smxUSBD User's Guide for more discussion of this.
Writing New Drivers
Contact us first to make sure we are not already working on the driver you need.
smxUSBD provides a function driver template and a section in the manual to help you write a new function driver, if needed.
smxUSBD provides a USB device controller driver template and a section in the manual, to help you write a new driver in case it does not support yours.
Porting
Little or no porting is necessary when smxUSBD is used with SMX®. It is designed to also work with other RTOSs and to run standalone, but it works best in a multitasking environment. The RTOS porting layer is handled by smxBase.
The hardware porting layer consists of two files, udport.h and udport.c. These files contain definitions, macros, and functions to port to a new processor. In addition, if the USB device controller is not among those already supported, a new driver will need to be written.
16-Bit Addressing Support
smxUSBD supports processors that can only do 16-bit memory addressing (not byte addressing) such as the TI TMS320C55xx DSPs. These processors are difficult to support for typical communication protocols because of byte data and byte fields in standard protocol data structures. This support is enabled by a configuration option in smxUSBD.
Testing
We test smxUSBD with USBCheck Version 5.1 on a Windows PC to verify that it passes the Chapter 9 USB compliance tests for full speed and high speed. We also test with USBCV v1.3 and it passes the Chapter 9, HID, and MSC tests.
Code Size
Code size can vary greatly depending upon the processor, compiler, and optimization level.
ARM Thm IAR (KB) | ARM IAR (KB) | CF CW (KB) | |
Core | 4 | 12 | |
Audio driver | 3 | 6 | 6.5 |
DFU driver | |||
Ethernet over USB driver | 2.5 | 3.5 | 4.7 |
HID Comm driver | 0.5 | 1 | |
Keyboard driver | 0.5 | 1 | 1 |
Mass Storage driver | 3 | 5.5 | |
Mouse driver | 0.5 | 1 | 1 |
MTP driver | |||
Serial driver | 1.5 | 2.5 | 2.7 |
Video driver | 11 | ||
Composite driver | 0.5 | 1 | 1 |
Analog Devices BF5xx | — | 3.3 | |
Atmel AT91 | 2 | 3 | — |
Atmel AT91 high speed | — | ||
Freescale CF5225x/1x/2x, Kxx | — | — | 5 |
Freescale CF532x/7x, 525x, 5445x, i.MX31 | — | ||
Maxim MAX342x | 3.5 | ||
NXP ISP176x | |||
NXP LPC31xx | 3.5 | — | |
NXP LPCxxxx | 2 | — | |
PLX Net2272 | |||
STMicro STR7/9, STM32F103 | — | ||
Synopsys, STMicro STM32F107, STM32F20x | |||
TI AM1x, AM35x, LM3S | 2 | — |
IAR = IAR EWARM; CW = CodeWarrior; VDSP = VisualDSP
Data Size
All RAM used by smxUSBD for data is pre-allocated from the heap during initialization. Following is a table of RAM usage:
Size (KB) | |
Core | |
Audio driver | 2 |
DFU driver | |
Ethernet over USB driver | 2 |
HID Communication driver | |
Keyboard driver | 0.5 |
Mass Storage driver | |
Mouse driver | 0.5 |
MTP driver | |
Serial driver | 1 |
Video driver (full speed) | |
Video driver (high speed) | 7 |
Composite driver | |
Analog Devices BF5xx | 0.5 |
Atmel AT91 | |
Atmel AT91 high speed | 0.5 |
Freescale CF5225x/1x/2x, Kxx | |
Freescale CF532x/7x, 525x, 5445x, i.MX31 | 1 |
Maxim MAX3421 | |
NXP ISP176x | 1 |
NXP LPC31xx | |
NXP LPCxxxx | 0.5 |
PLX Net2272 | |
STMicro STR7/9, STM32F101/2/3 | 0.5 |
Synopsys, STMicro STM32F105/7 | |
TI AM1x, AM35x, LM3S | 0.5 |
MTP data size is 6KB + ObjectsNum*64
Stack Size
smxUSBD has one internal task in the device controller driver that uses about 1KB stack (or 2KB for MTP). Application tasks typically use 0.5 to 1.5KB depending on the function driver
Performance
Mass Storage
The following table shows mass storage performance using a RAM disk in the device.
File Read (KB/sec) | |
BF5xx (HS) | 5000 |
1071 | |
ISP158x (HS) | 3890 |
Ethernet over USB
The following table shows Ethernet over USB performance for the indicated packet size and controller.
Packet Size (Bytes) | |
CF532x/7x (HS) | 256 |
Serial
The following table shows the transfer rate for sending and receiving serial data for different application packet sizes and controllers.
Packet Size (Bytes) | |
BF5xx (HS) | 800 |
1024 | |
ISP1362 (FS) | 140 |
256 | |
ISP1362 (FS) | 804 |
1024 | |
ISP1761 (HS) | 1830 |
1024 | |
MCF54455 (HS) | 8000 |
smxUSB Product Illustration (PDF)
For More Information
This application note explains how to configure the i.MX RT1050 as the USB Ethernet Gadget connected to the USB PC over the USB OTG High-Speed link.
The standard Linux Ethernet Gadget driver, with the CDC Ethernet support enabled, is used to implement this functionality. To provide support for Microsoft Windows USB hosts the gadget driver implements a second device configuration with 'Remote NDIS' (RNDIS) protocol supported.
In practical embedded applications, the Ethernet Gadget can be used for organizing TCP/IP-based communications with the i.MX RT1050 over the USB physical link.
Nxp Usb Devices Drivers
Configuration and Build
To enable Ethernet Gadget functionality in the rootfs project, do the following:
- Activate the cross development environment:
- Select the appropriate USB Gadget in the Linux configuration menu (go to the Device Drivers -> USB support -> USB Gadget Support -> USB Gadget Drivers menu, and select the Ethernet Gadget (with CDC Ethernet support) variant):
- Build the project:
[yur@ubuntu linux-cortexm-2.5.0]$ . ACTIVATE.sh
[yur@ubuntu linux-cortexm-2.5.0]$ cd projects/rootfs
[yur@ubuntu rootfs]$
[yur@ubuntu rootfs]$ make kmenuconfig
[yur@ubuntu rootfs]$ make
Run the resultant rootfs.uImage on the target. Observe the appropriate kernel messages indicating that the USB gadget is started:
...
using random self ethernet address
using random host ethernet address
usb0: HOST MAC 16:f2:10:f7:90:b7
usb0: MAC 4a:ef:b0:aa:d0:d4
using random self ethernet address
using random host ethernet address
...
g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
g_ether gadget: g_ether ready
...
/ # ifconfig usb0
usb0 Link encap:Ethernet HWaddr 4A:EF:B0:AA:D0:D4
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:60 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
The MAC addresses used by default are generated by the driver randomly. You can set up fixed values by adding appropriate variables to the Linux kernel command line in U-Boot:
- g_ether.host_addr=<value> (e.g. g_ether.host_addr=02:00:00:00:02:02) to specify the MAC address of the interface on the Host side;
- g_ether.dev_addr=<value> (e.g. g_ether.dev_addr=04:00:00:00:04:04) to specify the MAC address of the interface on the Gadget side.
Connect to the Linux Host
If the host PC is running Linux, messages like these shown below will be displayed in the i.MX RT1050 console upon connection to the host:
g_ether gadget: high-speed config #1: CDC Ethernet (ECM)
The host PC will detect the i.MX RT1050 as a CDC Ethernet device:
[yur@ubuntu ~]$ dmesg | tail
[ 8089.518624] usb 1-1.4: new high-speed USB device number 7 using ehci-pci
[ 8089.613487] usb 1-1.4: New USB device found, idVendor=0525, idProduct=a4a2
[ 8089.613502] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 8089.613509] usb 1-1.4: Product: RNDIS/Ethernet Gadget
[ 8089.613516] usb 1-1.4: Manufacturer: Linux 4.5.0-00428-g34d61b4a0ecd-dirty with 402e0000.usb
[ 8089.730616] cdc_subset: probe of 1-1.4:1.0 failed with error -22
[ 8089.732362] cdc_subset 1-1.4:1.1 usb0: register 'cdc_subset' at usb-0000:00:12.0-1.4, Linux Device, fa:19:ef:9b:12:0f
[yur@ubuntu ~]$ ifconfig usb0
usb0Link encap:Ethernet HWaddr fa:19:ef:9b:12:0f
inet6 addr: fe80::f819:efff:fe9b:120f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Connect to the Windows Host
The RNDIS/Ethernet Gadget driver installation procedure depends on the Windows OS version. Here are the instructions for different versions:
After the host driver installation is complete, the i.MX RT1050 will print the following information on the console:
g_ether gadget: high-speed config #2: RNDIS
TCT/IP Communications
Setup an IP address of the USB Ethernet interface on the USB Device (i.MX RT1050) side. Select an address that will not conflict with the other network sub nets in the system (if present):
/ # ifconfig usb0 192.168.2.2
Setup an IP address of the USB Ethernet interface on the USB host (PC) side (obviously, select the address from the same sub-net as the Gadget):
- Linux host example:
- Windows host example depends on the Windows OS version. Also make sure here that anti-virus/OS firewall services will not block the traffic over this interface.
[yur@ubuntu ~]$ sudo ifconfig usb0 192.168.2.1
Check communication between i.MX RT1050 and the host over USB with ping:
- on i.MX RT1050:
- on PC:
/ # ping 192.168.2.1 -c 3
PING 192.168.2.1 (192.168.2.1): 56 data bytes
64 bytes from 192.168.2.1: seq=0 ttl=64 time=1.044 ms
64 bytes from 192.168.2.1: seq=1 ttl=64 time=0.559 ms
64 bytes from 192.168.2.1: seq=2 ttl=64 time=0.574 ms
^C
--- 192.168.2.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.559/0.725/1.044 ms
[yur@ubuntu ~]$ ping 192.168.2.2-c 3
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
64 bytes from 192.168.2.2: icmp_seq=1 ttl=64 time=0.504 ms
64 bytes from 192.168.2.2: icmp_seq=2 ttl=64 time=0.370 ms
64 bytes from 192.168.2.2: icmp_seq=3 ttl=64 time=0.360 ms
--- 192.168.2.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.360/0.411/0.504/0.067 ms
Start the HTTP daemon on the i.MX RT1050:
Nxp Usb Devices Driver Win 7
/ # httpd -h /httpd/html/
NXP USB Devices Driver
Connect to the website on the i.MX RT1050 over USB from the host: