How does the USB Host handle data Tx/Rx when my USB device is a CDC Device with no Data Interface Class - cdc

Here's the background of what I am trying to accomplish:
I need my microcontroller (NXP i.MX RT series) to communicate with a
USB device (power meter) which is just a CDC Device that will appear
as a VCP. (I will simply call it 'the device' from here on to make
things simple)
Here's the issue:
With the NXP SDK's example USB CDC Host project (loaded on my NXP
eval board), the device is shown as 'not supported' when it is
connected to my eval board.
I also set up one of my STM32L4 eval board with USB CDC Device example code just for the sake of testing, and it is successfully attached and enumerated when connected to my NXP eval board.
Info below is per USB-IF standards
With USBView, I was able to see that the device's Device Class descriptor is 0x00, which means that this is an Interface Class Defined Device.
Looing at the Interface Descriptor section, I can see...
bInterfaceClass = 0x02 (Communications and CDC Control, per USB-IF)
bInterfaceSubClass = 0x02
bInterfaceProtocol = 0x01
So, this is a Communications (CDC Control) USB Device Interface Class device
However, the device does not have the CDC Data Interface Class (0x0A), something that a regular USB CDC device, like my STM32L4 eval board mentioned above, has.
My question to experts out there:
Assuming Data Interface Class is not required for a given CDC device,
how does the USB CDC host handle the data transfers? Does it happen
over the Control Interface?
Anyone who is experienced with NXP i.MX RT series MCUs know how to turn this device into a 'supported' CDC device and recognized by the MCU?
Thank you for any thoughts and insights!

Related

How does serial console communication work in a microcontroller?

My doubt is regarding the physical layer of the communication, I know from practice that for using for example teraterm to communicate with a MCU is simply enabling and configuring an UART peripheral, and then connect via USB the microcontroller and voila.
But it doesnt make sense to me yet that if USB connects to DN and DP, and an UART uses RX and TX, how does the host effectively communicates to the microcontroller?
There are two possibilities.
You connect to a USB/UART bridge such as devices made by FTDI or Prolific,
The microcontroller has a USB device controller and USB stack implementing the CDC/ACM device class (virtual COM port).
In the first instance, the bridge chip presents the CDC/ACM device to the host and exchanges data with a UART connected to the microcontroller UART. I/O control such as setting the baud rate have no impact on the USB connection, rather they are used to configure the UART link.
In the bridge arrangement, the bridge chip may be on the micro board, or it may be in a USB/serial adapter cable. Moreover internally the bridge chip is a microcontroller with a CDC/ACM device stack.
Unlike say RS-232, USB is not a peer-to-peer full duplex connection, and is not merely an electrical connection; USB requires quite complex device and host controllers and is more analogous to a device bus such as PCI than it is to UART serial connections. A CDC/ACM class device conforms to a specific protocol to allow a "virtual" UART to appear at the host. The UART you see at the PC is emulated, and is not physically the UART in the bridge.
The physical actual USB connection is a master-slave connection, with data and I/O control commands (such as baud rate and flow control) sent in USB packets to be unpacked, interpreted and transferred to the application layer via the CDC/ACM USB stack. In this arrangement the device, acting as a slave cannot initiate an exchange; rather the host continuously polls the device to which the device may return a packet containing its "tx" data. The polling and data rate of USB are fast enough to allow the simplex master-slave exchange to emulate a full-duplex UART connection, at higher throughput than can normally be achieved by a typical real UART, and certainly faster than a physical RS-xxx connection.
You can get an idea of how all this works by observing the raw USB data exchange using a tool such as WireShark. You will see that a lot more than just your application "serial" data is being exchanged.
You need to use a uart-usb interface IC that can convert uart to usb (and vice versa).

Microcontroller not recognized at USB port when connected via pins

Im having issues with my TI LAUNCHXL-F28379D. I have it connected to the laptop I am trying to send data to/from via pins P19 (SCIBRxD) and P18 (SCIBTxD), as well as GND and 5V via J16, using a USB Type B cord to which I sautered pin connectors. I'm sure power is being supplied to the board as when I plug the 5V cable of the USB cable, the RGB lights and 3 other small ones turn on. However, the Computer does not recognize ithe controller at the port - it only recognizes if if it is connected via the board's Mini-USB port. I've also written a C Program which opens the COM port and reads data - but this does not work without my knowledge of the COM port number, usually found in Device Manager. I cannot get any further in my project without the port number and it is very annoying. I will attempt to resauter a new USB cable, but if there are any other possible solutions, or if I'm doing something wrong, please let me know.
Absolutely all feedback is appreciated!
The SCIBRxD and SCIBTxD pins belong to the SCI peripheral in the microcontroller. This peripheral implements a UART port (a.k.a. COM port, a.k.a. TTL serial port). It is not a USB port. Nothing useful will happen if you connect it to a USB port, because it is not compatible with USB in any way.
USB-to-UART adapters (a.k.a. USB-to-serial adapters) do exist. There is one built into the LaunchPad. The UART side of the adapter is connected to the SCIB pins, and the USB side of the adapter is connected to the USB port.

print data to different terminal IAR

I am working on a project which contains acquisition of ECG data with the ADS1293EVM. MSP430F5529 is part of this board as well. For the communication between analog part of the board and microcontroller, I am using SPI and there is also FET Debugger from TI to program the microcontroller. Now I am printing data using printf to a terminal I/O which is part of the IAR software.
However, I would like to print ECG data to the terminal app in PC or to LabView, not in Terminal I/O in IAR software. The board is connected to the PC by USB so there is UART port in device manager. Is there any possibility?
Yes it is possible. You can push all the data on UART which is used in communication between PCB and PC. Than you can use any serial monitor for getting data displayed.
The only connection between your board and the PC is USB, so you have to implement a virtual USB COM port (CDC). TI's USB stack implements such an interface.

Linux Serial Device Server over USB?

I have an embedded Linux solution and want to create a command service over serial USB. The idea being that when a computer connects to my embedded via USB, they see a serial device and send serial commands to me through that port and I send responses back.
I need some help in the direction to proceed. Do I need to emulate a serial device so they see me as a COM port? Is there build in Linux solutions to broadcast my details as a serial device? Are there code examples? I can see block devices connect with my embedded solution like a USB storage device. When I plug into another computer, I would like it to see me as a serial COM port.
I just need help in the direction of which path I should go down to solve this.
Thanks in advance.
What you are looking for is the Linux USB serial gadget. The Linux USB gadgets framework allows devices to behave as a variety of standard USB devices, including serial devices, Ethernet adapters, and mass storage devices.
Note that USB gadgets will only work on targets with a USB controller that can be set to operate as a USB device. Not all USB controllers and target devices are compatible with this configuration. For instance, most PCs have a host-only USB controller, and the Raspberry Pi Model B is not compatible with gadgets because it contains an embedded USB hub upstream of the USB ports. (However, the Pi Zero is fully compatible with gadgets.)

How to use "control endpoint" (default endpoint) in client application?

I have USB HID device, which has only control endpoint. "USB Device Viewer" by Microsoft indicates 0 endpoints as it never counts control endpoints.
I don't know much about this device - it's basically black box to me. All I know is, that it's HID class and it's capable of simple serial communication (there's 1-Wire on "the other end of a cable").
As for HW, there's AVR MCU(not much help there). And as for FW, it uses VID, PID, which doesn't say anything to google (clearly made up).
I red here that after USB device is configured, one can use control endpoint for device specific use.
My question is:
Is it possible under Windows 7 using WDK to use control endpoint in user space application?
If not, is there any other way?
If yes, how?
HidD_GetHidGuid(&guid); doesn't even list my device. Probably due to the fact that device claims to be class 0x00 not only in device descriptor:
*bDeviceClass: 0x00 -> This is an Interface Class Defined Device*
but in interface descriptor too:
bInterfaceClass: 0x00
*!*CAUTION: 0 is a Reserved USB Device Interface Class
Did you run Wireshark? (Though I believe Wireshark doesn't monitor USB on windows - not sure about that. There are other USB packet sniffers around)
With wireshark you can monitor all communications to the device.
Though I don't know the WDK, I have the impression that many, if not most people use libusb (http://libusb.info/). There is a Windows version which can run on both 32 and 64-bit versions. This library is fairly easy to use, and has access to all endpoints.

Resources