USB CDC for IMXRT1021

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

USB CDC for IMXRT1021

Jump to solution
3,254 Views
nda
Contributor III

Hello. I am trying to start USB CDC driver on my board with rt1021.  I've created a project for this MCU and add FreeRTOS. All of that i did using SDK components. I've made changes to work from onboard flash. Now i want to use "USB Device CDC" from Midleware tab of SDK. I've checked it. Needed components were added to my project. What to do next? How can i use that component? What for do i need such tabs in SDK if there is now explanation how to use it? All ready to use examples for SDK for evaluation board have different structure.  

0 Kudos
1 Solution
3,173 Views
nda
Contributor III

The problem is in this - s_UsbInterface0CicVcom.startTransactions. It is set only if PC program will say  DTE_ACTIVATED. Termite doesnot send it. So  s_UsbInterface0CicVcom.startTransactions is always = 0. If I set it to 1, Termite and others work well. 

View solution in original post

14 Replies
3,229 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi nda,

   In fact, to the USB CDC, you totally can refer to the SDK cdc freertos project directly:

SDK_2.9.1_EVK-MIMXRT1020\boards\evkmimxrt1020\usb_examples\usb_device_cdc_vcom\freertos

  You even can copy that project and rename it to your own project name, then you can based on that project and add your own code.

 

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

0 Kudos
3,206 Views
nda
Contributor III

By the way, this example(SDK_2.9.1_EVK-MIMXRT1020\boards\evkmimxrt1020\usb_examples\usb_device_cdc_vcom\freertos) works only with one terminal program -  Putty. Others does not work (for example CommTest or Termite). Hardware tested - MIMXRT1020-EVK.  

0 Kudos
3,197 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi nda,

   Do you mean, when use other terminal, can't receive the CDC printf information? Or can't input?

   I use the tera Term, it also works:

image.png

 

Wish it helps you!

Best Regards,

Kerry

0 Kudos
3,193 Views
nda
Contributor III

Hello, Kerry. Thank you for your answers. TeraTerm works well as Putty. Please  try Termite( https://www.compuphase.com/software_termite.htm) It does not work. Sending of first string works, all others does not. USB doesnot respond after first string.

0 Kudos
3,190 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi nda,

   In fact, tera input contains CR directly.

   So your Termite sending also need to add the CR, I also test your tool, but I don't think that tool is very good, as it even can freezen.

image.png

I also test other a lot of terminal: tera, hyperterminal, serial hunter, SSCOM, local terminal, all works OK.

 Just your shared tool, always can't work, and when I try to add the CR in the configuration, that tool even freezen, no response, so, I think your tool is also not stable, I suggest you use the tera or other working terminal.

 

Best Regards,

Kerry

0 Kudos
3,188 Views
nda
Contributor III

Termite is not the only program that doesnot work. As I've mentioned before - CommTest also doesnot work. All these programs work with other CDC devices. For example FTDI or CDC from STM. They have problem only with USB stack  for MXRT. So - i suppose the problem is not in programs.

0 Kudos
3,181 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi nda

  Do you meet the Termite no response issues?

  Do you try to add the CR? I don't know why, when I configure your termite with CR, it will no response, and I need to close that window.

   If you didn't meet the no response issues, can you try add the CR when input the data?

 

Best Regards,

Kerry

0 Kudos
3,174 Views
nda
Contributor III

The problem is in this - s_UsbInterface0CicVcom.startTransactions. It is set only if PC program will say  DTE_ACTIVATED. Termite doesnot send it. So  s_UsbInterface0CicVcom.startTransactions is always = 0. If I set it to 1, Termite and others work well. 

3,169 Views
nda
Contributor III

Or we can use Flow control in Termite or others. In such way, example will work without modifications.

0 Kudos
3,224 Views
nda
Contributor III

Thank you kerryzhou for your answer. I have already tested that exmaple. It works well. My main question is in absense of documentation - how to use SDK. I can add needed components to my project using button "Manage SDK components". When i add USB components i want to understand what to do next? I understand that i can copy/paste some functions from example, but i think where is another way. And this way exist. I found that i can automaticaly initialize USB module in MCUXpresso configuration. After that USB is fully operable. I didnt find any documents where i can read about all the settings of USB initialization. I want to use some other modules, and i want to understand how to configure them. May be somebody will open my eyes, if such docs exist?

0 Kudos
3,222 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi nda,

   Thanks so much for your updated information.

   For the details, I recommend you read the SDK USB related document, which you need to download your SDK related document. eg.SDK_2.9.1_EVK-MIMXRT1020_doc.zip

 SDK_2.9.1_EVK-MIMXRT1020_doc\docs\USB

  In this folder, you will find the MCUXpresso SDK USB Stack User's Guide.pdf and MCUXpresso SDK USB Stack Device Reference Manual.pdf which will be useful to you!

  Please check it at first.

 If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

0 Kudos
3,219 Views
nda
Contributor III

I've read that pdf before making a post. 

I wanted something like this - https://www.nxp.com/design/training/basic-application-development-using-mcuxpresso-ide-and-mcuxpress...  (part3) but about USB device not Host.

Where can i read about this preferences:

nda_0-1613644987260.png

Why there are 2 interfaces for one CDC VCOM config?

0 Kudos
3,200 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi nda,

   Thanks for your updated information.

    The CFG tool is an important tool to generate the USB application code. So your link video is very good.

    Device is similar.

    About the CIC and DIC which you mentioned, it is determined by the USB CDC protocol.

   One CDC device consist of two interface: communication Interface class and Data interface class

   So your CIC is communication interface

   DIC is data interface class

   That's why one CDC you select two interface.

   It is determined by the CDC required interface.

  You can use the CFG tool to generate one CDC device project, if you meet any issues, just kindly let me know.

Wish it helps you!

Best Regards,

Kerry

 

0 Kudos
3,245 Views
mjbcswitzerland
Specialist V

Hi

In case of difficulties check out the following:

https://www.utasker.com/iMX/RT1020.html

Out-of-the-box solution for 1021 with bullet-proof USB-CDC as host or device (including RNDIS, composites and CDC to LPUART bridges). Includes FreeRTOS setup (although not needed), TCP/IP operation, file systems, Modbus, etc. and complete processor/operation simulation. Plus complete out-of-the-box secure in-field/OTA boot loading concept (with optional on-the-fly decryption) with no developer effort.

It is ideal for robust product developments that need to be completed quickly and avoiding the usual long learning curves and project delays they cause.

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, solutions to problems or rapid product development requirements

For professionals searching for faster, problem-free Kinetis and i.MX RT 10xx developments the uTasker project holds the key: https://www.utasker.com/iMX/RT1020.html

0 Kudos