KL43Z USB CDC in KDS & PEx

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

KL43Z USB CDC in KDS & PEx

1,176 Views
juanjovicente
Contributor II

Hello everyone,

 

I´m trying to implement a USB CDC-class communication between a KL43Z-based board and a PC.

 

I´ve seen there is an example in KSDK 1.2 showing how to implement this. I´ve compiled and tried it and works fine, but it´s just an example, I need it to do a lot more than just an echo.

Unfortunately this example is made in CodeWarrior so I need to migrate it into KDS in order to be able to make some changes on it and, -most importantly-, use Processor Expert to include some other features I need.

 

I think I have a preliminary migrated project but although it seems good, once I build it and flash my board, when I connect it to the PC, it does not recognise my board as a COM port (as it did with the Codewarrior project).


I´m kind of crazy looking for which differences could make this not to work properly. ¿Could anyone help on this? ¿Any advice on which should be the strategy to find them?

 

Once I get this code working I will share it in this forum because I think this will be extremely useful for everyone looking for a USB communication besides a HID or a MSD.

 

Thank you all,

Juanjo

(www.bq.com)

Original Attachment has been moved to: KL43Z_USB_Integration.zip

2 Replies

676 Views
isaacavila
NXP Employee
NXP Employee

Hi Juanjo,

I decided to make a new KSDK project with PE support and copied code from CDC example and got same problem than yours.

I was able to find the root cause of it: KL43Z was not responding to USB commands (no response to GetDevicedescriptor command, so that is why device was not enumerated). In this case, clock source for USB needs to be 48 MHz (as I was configuring correctly) but, core clock needs to be at least 20 MHz (In my case, core clock was configured by default to run to 4 MHz), so, that is why PC did not get response from device.

Then, i made some changes in order to get core running to 48 MHz.

In PE manager, select clockMan1:fsl_clock Manager and look for Clock Settings window (as show below)

01_Change to HIRC mode.jpg

Then, if select MCG Lite Settings tab, current selected mode is LIRC_8M, so, MCGOUTCKL is 4 MHz (below core's minimum value), so, I changed it to HIRC to get a 48 MHz clock signal in MCGOUTCLK.

02_Change_HIRC.jpg

Now, we must set core clock and bus clock to 48 MHz and 24 MHz respectively, Select System clock tab and then set these frequencies as shown below:

03_Set Core Clock.jpg

I saved these changes, generated the new code, compiled again my project and tested it, I noticed it works correctly. I attach this example so you could test it too.

Unfortunately, when I did same modifications on your project, i got an error and device was still not being enumerated (modifications on clock module does not get updated, it seems to be a path error in your project settings). I will be working on it but meanwhile you can use my project and try to add your additional code.

Best Regards,

Isaac Avila

676 Views
isaacavila
NXP Employee
NXP Employee

Hi Juanjo,

I'll try to find the root cause for your project.

You mentioned about CW demo, but all KSDK demos are also available for KDS too,  so you can try to use them meanwhile i can find the problem on your current project.

Regards,

Isaac

0 Kudos