How to integrate several drivers using KSDK in a baremetal application

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

How to integrate several drivers using KSDK in a baremetal application

982 Views
MAPC
Senior Contributor I

Hello,

 

I'm starting a new project with K64 where I have some GPIO's, USB-CDC device(virtual comm), a Http server, ADC to read some sensors and a timer to generate PWM to control a BLDC motor.

 

I like and feel very comfortable to use the new Processor Expert beans in KDS 3, but I'm not sure if it is a good idea to use them for USB_CDC and HTTP server, because there are not specific beans fpr them and I can imagine how hard it could be to use "fsl_usb_framework" and "fsl_enet" for that.

 

Is it possible to initialize  ADC, GPIO's and Flex Timer through Processor Expert and include the other peripherals manually? I'm afraid that this might cause conflict between Processor Expert files and the ones that I include manually.

 

I read a document from KSDK directory called "Freescale KSDK USB Stack Developing New Application User’s Guide" that explains how to create a new application with USB using KSDK, but the method recommended is to create a new directory like "<my_proj_directory>/examples/frdmk64f/demo_apps/usb/device/cdc/my_app/bm/kds" and copy the files from "<install_dir>/examples/frdmk64f/demo_apps/usb/device/cdc/virtual_comm/bm/kds".

 

If I create a new project and enable Processor Expert support, do I have to do it as mentioned in "Freescale KSDK USB Stack Developing New Application User’s Guide" or can I create my project in other directory and manually copy the USB and LWIP files from original locations in KSDK and include their paths in Compiler Settings?

 

It is a little confusing for me yet and there not any clear documentation boarding that.

 

Can someone help me please?

 

 

Thanks,

 

Marco Coelho

Labels (1)
5 Replies

470 Views
tmeyer
Contributor III

Hi Marco,

I’ve recently came to the similar situation where I wanted to add the USB CDC driver to my project where I was already using PE. Initially I copied all the required usb driver related files into my project and add the paths as you suggested. I used the example projects: dev_cdc_virtual_com_frdmk22f_mqx_frdmk22f & usbd_sdk_frdmk22f_mqx_frdmk22f as my reference projects. This worked fine, however as I added more drivers to my project I hit the Windows command line character limit when compiling. I ended up pulling the usbd_sdk_frdmk22f_mqx_frdmk22f files back out and creating a new project to compile it as a library instead. I suspect you will have to do the same, especially if you are using the network stack too. (If this doesn’t work for you, there is an eclipse plugin that allows you to work around the Windows command line limit.)

Note: Freescale is creating a new tool to help us out with this. It is called “Project Generator” https://community.freescale.com/thread/359160. I’ve used this, but it in in Beta and all the featured aren’t release yet. I think it will eventually include support to add the USB drivers to your project as well.

Regards,

Tim

470 Views
MAPC
Senior Contributor I

Hello, Tim

Thank you very much for sharing your experience with me. I didn't understand what you mean when you say "compile it as a library instead". Could you explain it to me in more detail, please?

I still don't understand why "Freescale KSDK USB Stack Developing New Application User’s Guide" says to create a new USB project in "<install_dir>/usb/example/device/xxx", instead of my own project directory. That is so strange.

The dev_cdc_virtual_com_frdmk64f_bm demo links to the USB drivers and SDK files and doesn't copy them. Sometimes I feel confused about what is the best and easiest way: link or copy the files.

By the way, I didn't find the Project Generator in FRDM-K64F Quick Start Package.

Regards,

Marco Coelho

0 Kudos

470 Views
MAPC
Senior Contributor I

Forget about the SDK Project Generator, Tim!

My fail! It was on the last page of the step by step guide. But I just installed it and it looks like the "Advanced" menu is not showing up. I will communicate this in original post in this Community.

pastedImage_0.png

0 Kudos

470 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Marco Aurelio:

The new version of project generator is being tested with the Advanced configurations enabled, but right now I don't have a release time estimate. As soon as I get some news from development team I will let you know.

As for KSDK + Processor Expert, you should have no conflicts using PE and at the same time adding other libraries manually. Actually from my perspective this is an advantage of the new Processor Expert, it should not interfere with adding more stuff manually, since it is actually aimed to ease the configuration of KSDK drivers, but it does not generate its own drivers.

Here you have some hints:

- Right now Processor Expert only supports MSD and HID classes from KSDK USB stack. Below document shows you an example for MSD:

How to implement a USB Device MSD demo based on KSDK PEx components and KDS 3.0

- If you are interested in CDC, then you can create a project with PEx support and pull in the required USB library. This is explained by colleague Issac Avila in this document:

Creating a New USB project with KSDK and Processor Expert support in KDS

- For the Ethernet part, there is also a document for adding RTCS to a PEx project:

How to add RTCS to a Processor Expert Project Using KDS and KSDK

I hope these guides will serve you as reference.

Regards!

Jorge Gonzalez

470 Views
MAPC
Senior Contributor I

Hello, Jorge

I have followed Issac's instructions and it worked perfectly. Now I can perfectly integrate the USB stack to my KDS/SDK project either with Processor Expert or not. I haven't read the other documents yet. At this moment, I'm focusing on the USB part of my application. But I'm longing to include and work with RTCS stack as well, following the document posted by Carlos Musich. I took a quick look at his document and it looks as good and clear as Issac's and I was looking for and missing documents like those.

Congratulations to you and your coleagues that have provided a great support with helpful posts and docs in Community. You should include them in the next KSDK package.

Thanks and best regards,

Marco Coelho