AN12597 USB to Multi VCOM on K32L2 Series MCU (KL27 on Win 7)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AN12597 USB to Multi VCOM on K32L2 Series MCU (KL27 on Win 7)

Jump to solution
2,350 Views
jh0
Contributor IV

Hi,

I started to write my own USB stack (from zero) based on Kinetis KL27 SDK. I need highest possible number of virtual COM's, so later it was updated to AN12597. However, even device was enumerated correctly (with only one or all 15 ports) on Windows 7, it doesn't work. After first message sent from PC, respond was OK, but after second there was no more IN token done message. Communication for micro to PC freezes. There is no problem in transfer from PC to micro.

I was thinking that something is wrong with my USB stack, and I opened related topic...

https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL27Z64-USB-EP1-IN-OUT-data-tansfer/m-p/10735...

After coding without any progress, I turn back my USB stack to standard CDC with interrupt EP, and it start to work without any problems. So there must be something "special" related to AN12579, and to clear things up, I checked AN12597 original code (with some minimum changes for echoing to my PC program).

And I replicated problem with AN12579 source in my setup. Don't have K32L board. Project is ported to KL27 and builded by MCUXpresso (last version). For testing, I use 2 ports (#define USB_DEVICE_CONFIG_CDC_ACM 2). When CDC with interrupt EP is used (#define USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE 1) everything is OK. But when interrupt EP is removed (#define USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE 0) devices is enumerated correctly but after one correct echo, it freezes, exactly the same as with my USB stack.

I am using Win 7 and port from PC side is just opened (CreateFile), without BR or any other settings.

Regards,

Josip

Labels (1)
0 Kudos
1 Solution
2,245 Views
jh0
Contributor IV

Hi,

Problem is OS related. I installed Win10 2004 on the same laptop and AN12597 without interrupt EP (#define USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE 0) is working OK.

Regards,

Josip

View solution in original post

0 Kudos
10 Replies
2,344 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi jh0,

   If you totally use the SDK vcom project, whether you can recoginize the CDC and send the data correctly?

   Or you just have the multi VCOM issues?

  When you Communication for micro to PC freezes, do you debug your code, whether your code is stopping at some code line?

 

Best Regards,

Kerry

0 Kudos
2,327 Views
jh0
Contributor IV

Hi Kerry,

CDC echoing from SDK 2.8.0 is working OK.

CDC echoing from AN12597 multi vcom optimized (#define USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE 1) is working OK.

AN12597 multi vcom optimized echoing (#define USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE 0) is not working OK.

At the end of AN12597 pdf there is section 7 Function test, with picture of enumerated ports, and this is OK, because device will be enumerated fine in any USB_DEVICE_CONFIG_CDC_ACM / USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE combination.

AN12597 multi vcom optimized echoing will work only once, when PC sends 1st message of any length, device will receive it correctly and send it back to PC. When PC sends 2nd message (of any length) device will receive it correctly and try to send it back to PC, but after sending first packet of 64 bytes, IN token done from PC will never come, and device will not be able to continue with sending other 64 byte packets. I injected some logs in AN12597, and I can list them here if this will help.

Regards,

Josip

0 Kudos
2,311 Views
mjbcswitzerland
Specialist V

Hi Josip

There is a binary and windows drivers for the FRDM-KL27Z at https://www.utasker.com/kinetis/FRDM-KL27Z.html which installs as 3 x CDC plus mouse composite and bridges between the CDC interfaces and the devices UARTs and LPUART.
The source code is available in the uTasker open source project on GitHub.

See whether it has similar issues and whether it is the driver that you are missing (.inf for Win 7 and Win 8 also at the link which will allow 1 to 7 CDCs). Also see how it uses interface association descriptors to control multiple CDCs.

Regards

Mark
uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training or product development requirements

 

2,308 Views
jh0
Contributor IV

Hi Mark,

First, thank you for detailed description of DATA0/1 and EVEN/ODD handling from my older topic (that is related to problem that I have with AN12597).

From your .inf file I see that your device is standard composite CDC (with interrupt endpoint)...

%DESCRIPTION%=DriverInstall, USB\VID_15a2&PID_ff45
%DESCRIPTION%=DriverInstall, USB\VID_15a2&PID_ff45&MI_00
%DESCRIPTION%=DriverInstall, USB\VID_15a2&PID_ff45&MI_02
%DESCRIPTION%=DriverInstall, USB\VID_15a2&PID_ff45&MI_04

and I don't have any problem with this. My USB stack work with 4 (or any other number) x CDC just fine until interrupt endpoint's are used.

My problem is related to multi VCOM AN12597 without interrupt endpoint.

I just checked original AN12597 .inf file and there is some difference with one that I used (from composite CDC SDK example, similar to your). Just to be sure, I will cleanup USB tree of installed devices and try again, to install it with original AN12597 .inf file.

Regards,

Josip

0 Kudos
2,299 Views
mjbcswitzerland
Specialist V

Hi Josep

I haven't understood the exact problem that you have but I have attached a binary that you can load to the FRDM-KL27Z board which is a 15 x CDC composite that echos back whatever is received on each VCOM and so possibly is the same operation as the AN12597 reference.

The .inf just needs to be extended to 15 interfaces (counting 00, 02, 04, as before but going up to 28). I simply removed each CDC interface's interrupt endpoint (as detailed in the AN) so that 15 were possible. Windows 10 doesn't need any .inf since it automatically installs.

If this works it means that you have a good reference to compare with and it may be easier to work out what the exact issue is. If you send me a binary for the FRDM-KL27Z that also has 15 CDCs but doesn't work as intended I can load it to my board and tell you what the difference is based on the USB activity that I can record with my analysers.

Regards

Mark
uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training or product development requirements

 

2,284 Views
jh0
Contributor IV

Hi Mark,

Thank you for attached utasker 15 CDC binary. It has same problem as AN12597 or my USB stack.

For clear up, I used original AN12597 and attached utasker binary with Tera Term on PC side.

If AN12597 CDC with interrupt EP is used (#define USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE 1), after each key is pressed, there is character echo in TeraTerm window.

If AN12597 CDC without interrupt EP is used (#define USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE 0) or attached utasker binary, there is character echo in TeraTerm window only once, after first key is pressed. Exactly the same problem that I have with my PC side and my USB stack.

I guess that problem is related to Win 7 SP1. I will check it on Win 10 and Ubuntu. However, I want to my project work on any Win (down to XP), Mac OS or Linux, so maybe at the end using 15 CDC will not be possible.

Regards,

Josip

0 Kudos
2,229 Views
bobpaddock
Senior Contributor III

Could this be related to WinUSB in some way?
Some older Windows stacks had USB issues.
Also WinUSB was not part of XP or Win7 unless it was added via a Windows Update.

 

0 Kudos
2,215 Views
jh0
Contributor IV

Hi Bob,

This is not related to winusb.sys (that I used without issues on WinXP with some other USB devices) because it is not used with CDC.

I think that this is related to usbser.sys, version 6.1.7601.17514 (21.11.2010.) on Win7 and older.

With usbser.sys, version 10.0.19041.1 (7.12.2019.) on Win 10 2004 it is working fine.

Regards,

Josip 

0 Kudos
2,270 Views
mjbcswitzerland
Specialist V

Hi

I don't have the possibility to check for differences on the other OS at the moment so please report back when you have results.

Regards

Mark

0 Kudos
2,246 Views
jh0
Contributor IV

Hi,

Problem is OS related. I installed Win10 2004 on the same laptop and AN12597 without interrupt EP (#define USB_CDC_CIC_INTERRUPT_IN_ENDPOINT_ENABLE 0) is working OK.

Regards,

Josip

0 Kudos