Hello!
I am currently looking into interfacing my RT1062 with a power meter, which is a USB CDC device. However, this device is using USB Interface's Base Class = 0x00. It means that the actual USB Class type is subsequently defined by its Interface Class. Using USBView to view the bInterfaceClass value, I was able to confirm that this device is of CDC Class:
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x03
bInterfaceClass: 0x02 -> This is Communications (CDC Control) USB Device Interface Class
bInterfaceSubClass: 0x02
bInterfaceProtocol: 0x01
Both the Interface Class and Interface SubClass are 0x02.
The issue with this particular device is that it does not use any CDC Data Class (0x0A). Looking through the SDK example usb_cdc_host, it seems that the example functions by relying on the fact that the device needs to provide the Data Class in addition to the Control Class.
As of now, whenever I connect the power meter to my RT1060 EVK with the usb_cdc_host programmed, terminal will report 'device not supported.'
Is there any additional SDK example that would allow a device like this power meter that I am attempting to connect with to work with my RT1062 processor, which is set up as the USB CDC Host?
Any pointer or resource would be greatly appreciated!
Thank you,
Kenneth
解決済! 解決策の投稿を見る。
Hi @kennethkong852 ,
The USB CDC host example is used to interface with a VCOM device. There isn't other example which can interface with other kind of CDC device. You can modify this example to fit with your power meter. In host_cdc.c, from line 645 to line 694 is to check the device's type. The first for...loop is to check Community Interface Class and the second for...loop is to check the Data Interface Class. You can modify USB_HOST_CDC_DATA_CLASS_CODE to see if it can be supported.
Regards,
Jing
Thank you very much! I have gotten both CDC and MSD hosts on same USB port/controller!
Hi @kennethkong852 ,
The USB CDC host example is used to interface with a VCOM device. There isn't other example which can interface with other kind of CDC device. You can modify this example to fit with your power meter. In host_cdc.c, from line 645 to line 694 is to check the device's type. The first for...loop is to check Community Interface Class and the second for...loop is to check the Data Interface Class. You can modify USB_HOST_CDC_DATA_CLASS_CODE to see if it can be supported.
Regards,
Jing
Thank you! I was able to modify and it supported the particular device I was attempting to interface with!
Much appreciated for the information!
Now the follow up question is as follows:
Thank you!
Hi @kennethkong852 ,
Yes, you can. You can refer to the host_keyboard2mouse_bm demo for how to make a composite host.
To use OTG2, you can set controllerId to kUSB_ControllerEhci1.
Regards,
Jing
Hi Jing,
Thank you for the info! I hope I didn't make it confusing...
What I was trying to say was that I wish to set up OTG2 (controllerId = kUSB_ControllerEhci1) to support different devices plugged in (for example, a flash memory stick drive or a cdc device like the power meter as described previously).
In this case, do I just need 1 count of g_hostHandle overall in my project (even though I have two different host types)?
And within the USB_HostEvent(), do I need to call both USB_HostMsdEvent() and USB_HostCdcEvent() in these cases:
kUSB_HostEventAttach, kUSB_HostEventEnumerationDone, kUSB_HostEventDetach
Thank you once again!
-Ken
Hi @kennethkong852 ,
Q: do I just need 1 count of g_hostHandle overall in my projec?
A: yes
Q: And within the USB_HostEvent(), do I need to call both USB_HostMsdEvent() and USB_HostCdcEvent() in these cases?
A: yes. You can refer to the example.
Regards,
Jing
Jing,
Thank you so much! I have finally gotten both my CDC & MSD Hosts work on same USB controller!
Best Regards,
Kenneth