MQX USB CDC Driver: Multiple Instances?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MQX USB CDC Driver: Multiple Instances?

跳至解决方案
2,115 次查看
CzechThunder
Contributor III

Hello,

We're using the MQX USB CDC driver on a Kinetis K70 processor.  We use the updated version of "fsl_ucwxp.inf" file to install the driver, which then loads "usbser.sys".  It has been working very well on the embedded side but the Windows driver side has a few issues.  I thought I would ask and see if anyone has experience or can point me to a solution:

1) Multiple instances of the driver show up as the same COM port on the PC.  The install of the Windows driver seems to work okay, but terminal programs don't see two separate COM ports, even when the actual COM port number is unique for the two devices.  Only one of our device can connect at a time.  Is this a limitation of the driver?  Any easy fix for this?

2) We've found that the driver installs on most PCs, but we have a customer with ASUS CPU boards and the driver won't install.  It reports a "driver cannot initiate" error.  Are there any known hardware incompatibilities with the driver?

Rgds,

Gary

标记 (4)
0 项奖励
回复
1 解答
1,404 次查看
CzechThunder
Contributor III

UPDATE:  I was digging through the usb_descriptor.c file for the MQX USB stack and I think I may have stumbled across the solution.

This should have been obvious but it's kind of buried in the stack.  There is a manufacturing ID string, product ID string, and a serial ID string that are all part of the USB descriptor.  It seems that the serial number string should be unique for each hardware instance running the USB stack.  The exact section of code that defines this string is:

uint8 USB_STR_0[USB_STR_0_SIZE+USB_STR_DESC_SIZE] =

                                    {sizeof(USB_STR_0),  

                                     USB_STRING_DESCRIPTOR,

                                      0x09,

                                      0x04/*equiavlent to 0x0409*/

                                    };

So the default serial number is "0x0409".  When I changed that to a unique number for my second device, they both instantly started working at the same time.  I was able to open two terminal sessions with no issues.  So it seems the driver is fine and will support multiple instances.  I hope this info is helpful to someone.

As far as the device not starting error on the ASUS board, I'm wondering the default MQX vendor ID (2504) and product ID (0300) are perhaps in conflict with something else in that system? 

在原帖中查看解决方案

0 项奖励
回复
5 回复数
1,405 次查看
CzechThunder
Contributor III

UPDATE:  I was digging through the usb_descriptor.c file for the MQX USB stack and I think I may have stumbled across the solution.

This should have been obvious but it's kind of buried in the stack.  There is a manufacturing ID string, product ID string, and a serial ID string that are all part of the USB descriptor.  It seems that the serial number string should be unique for each hardware instance running the USB stack.  The exact section of code that defines this string is:

uint8 USB_STR_0[USB_STR_0_SIZE+USB_STR_DESC_SIZE] =

                                    {sizeof(USB_STR_0),  

                                     USB_STRING_DESCRIPTOR,

                                      0x09,

                                      0x04/*equiavlent to 0x0409*/

                                    };

So the default serial number is "0x0409".  When I changed that to a unique number for my second device, they both instantly started working at the same time.  I was able to open two terminal sessions with no issues.  So it seems the driver is fine and will support multiple instances.  I hope this info is helpful to someone.

As far as the device not starting error on the ASUS board, I'm wondering the default MQX vendor ID (2504) and product ID (0300) are perhaps in conflict with something else in that system? 

0 项奖励
回复
1,404 次查看
DavidS
NXP Employee
NXP Employee

Hi Gary,

Sorry you had issue but very thankful to you for your persistence and for sharing to the community.

Thanks,

David

0 项奖励
回复
1,404 次查看
CzechThunder
Contributor III

It seems I'm still missing something.

I can get two instances of my device to connect and communicate simultaneously.  So the usbser.sys does appear to support multiple instances as expected.

However, if I remove one of my devices by physically disconnecting the second USB cable, the first device stops transmitting.  The first device's port is still in the Windows hardware profile, and oddly enough, the first device is still able to receive data, but can not transmit.   It is almost as if usbser.sys stops sending IN tokens to the first device when the second device is disconnected.

Any ideas on how to resolve this?

rgds,

Gary

0 项奖励
回复
1,404 次查看
DavidS
NXP Employee
NXP Employee

Hi Gary,

This is getting deeper than my knowledge base on USB.

I'm trying to track someone else with the knowledge.

Regards,

David

0 项奖励
回复
1,404 次查看
CzechThunder
Contributor III

Thanks David.

I made some progress.  It appears that in Windows 7, multiple instances work much better.  I can connect and disconnect without as many hiccups or cross conflicts.  I think Windows 7 may be "sandboxing" usbser.sys.

So this may be a Windows XP usbser.sys issue.  I'll keep beating on it...

Gary

0 项奖励
回复