How to incorporate USB CDC vcom example into custom mcuxpresso project

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

How to incorporate USB CDC vcom example into custom mcuxpresso project

2,156 Views
inorman
Contributor III

We've a custom project designed loosely based on the freedom k64 so I've create a new project through the mcuxpresso ide to included all the middleware required usb / lwip / spi etc but how do I now bring in the functionality of the usb vcom example into my custom project?

Is there a guide on how to link in the file from these examples?

Kind regards

Ian

Tags (1)
0 Kudos
6 Replies

1,463 Views
inorman
Contributor III

For me the bare bones project worked OK, but I had a lot of problems getting my custom project going. In the end I had to go direct to nxp technical support who managed to get it going.

Some were path issues and also having to compile the usb stack as somehow when copying the usb folders the exclude from compile box ended up being ticked.

Hope your making progress.

Ian.

0 Kudos

1,463 Views
randylee
Contributor V

I went a couple of directions on this for starters.  I got a FRDM-K22F board which means that I now have reference hardware that I know works with something.  I used the example for SDK2.5 and got that to at least enumerate.  I don't have UART connections and this example is attempting to be a USB-UART bridge basically so I don't know if it's working but at least have it stable and enumerated correctly.

What that DID show me was that a) there was a way to do it (even if it was a bit opaque) and b) I was able to modify the FRDM-K22F example for my clock tree and get it to work.

I ALSO grabbed an example from Erich Styger (MCU on Eclipse: https://mcuoneclipse.com/ a MOST recommend follow) that uses an MCUexpresso friendly version of his Processor Expert beans to generate pretty much the same project but a little different USB stack (and an instrumented FreeRTOS) and a way different internal transport mechanism.  That one also worked on the FRDM-K22F board out of the box.  It was here that I discovered the clock tree differences (and had some communications with him directly on the subject).

So, now I've got some code ported into my project from NXP example with some blending of Erich's backing utilities and I'll see if I can get that to enumerate at least.  After that I have to edit out the UART stuff and connect all that internally to my other stuff that expects to talk out it.

Slow progress but at least progress.

If NXP is listening: MCUexpresso has a ways to go to be ready for prime time.  Some things are better than PEx (like the clocks tool). The middle way stuff needs to be way better than it is.  And you can ignore Deoxygen as a tool for documentation -- it just pretends to do a job.

Cheers,

0 Kudos

1,463 Views
randylee
Contributor V

I'm attempting [almost] the same thing with miserable luck. My final project is using FreeRTOS on a K22F512.

I imported the example file in SDK 2.5 folder using the IDE find examples thing targeting a frdmK22F(frdmk22f_dev_cdc_vcom_freertos)

This thing is set up to use a file called serial_manager.c.  The .h file has it set up to use a UART (which my board doesn't have).  When I edit that to use CDC, it's attempting to include a file called serial_port_usb.h which isn't included in the example.

The example isn't set up for the current IDE and tools (MCUexpresso 10.3) so I can't just open that up and see what other things it's configured for and documentation is non-existent on any of this stuff that explains the internals of it.  Top that off with a plenty convoluted code base and I haven't been able to take apart the stuff that isn't required in this whole project to get it into mine.

Also looking at that example code, there are a number of things going on there that would be taken care of in the normal SDK load like clocks and all that.  Those I can trim out I think.

All I want is a USB CDC connection into my FreeRTOS enviroment (non-blocking IO) so I can send data and other things out that port (and get packets of information back in).  This shouldn't be this hard to implement.

So, using the configuration stuff on MCUexpresso, is there a section of stuff to check that gives you the CDC interface or does a person need to grab something like the USB device and add CDC specific stuff to it or what?

0 Kudos

1,463 Views
randylee
Contributor V

So a related question to this: How do you create a CDC bare bones project in 10.3 with SDK 2.5?  I'm missing something or other big time here. 

My steps: Create no board version of K22FN512 project.  Add the following:

pastedImage_1.png

you get a project that doesn't compile for missing stuff in it.  Is missing usb_device_descriptor.[ch], serial_port_usb.[ch] (indeed it's missing serial_port_uart.[ch] which is what the serial manager is default configured for) and it's missing the generic_list.[ch] files as a starter.  It generates a default main that doesn't actually start up the interfaces at all as far as I can tell or at least the CDC serial port doesn't enumerate at all.

So, does anyone have a bare bones CDC example for a bare chip like this?

0 Kudos

1,463 Views
jeff_hane
Contributor I

I initially tried just doing a bare bones CDC also and had issues so went back and created a new project from the cdc_vcom example.  If I remember correctly, the bare bones actually pulls in code for all the interfaces and then you have to figure out what the build so it was just easier to use the example.

jeff

0 Kudos

1,463 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Ian Norman

I would suggest you refer to the MCUXpresso SDK User's Guide.pdf for how to do it.

This doc is under the installation folder

SDK_2.3.0_FRDM-K66F_doc\docs\usb\MCUXpresso SDK USB Stack User's Guide.pdf

pastedImage_1.png

I hope it helps.

Regards

Daniel

0 Kudos