USB Device CDC on KSDK PEx components and KDS 3.0 and KSDK 1.2.0 or KSDK  1.3.0 .

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

USB Device CDC on KSDK PEx components and KDS 3.0 and KSDK 1.2.0 or KSDK  1.3.0 .

跳至解决方案
6,868 次查看
PitOn
Contributor III

Hardware and software configuration:

FRDM-K64F

OpenSDA J-Link firmware

KDS 3.0 with KSDK 1.2.0 and KSDK 1.3.0 Eclipse update installed.


 

KDS no updates: 

GNU ARM C/C++ Cross Compiler 1.14.1.201508190739

GNU ARM C/C++ J-Link Debugging 3.2.1.201508190739

GNU ARM C/C++ OpenOCD Debugging 3.2.1.201508190739

 

File→New→Kinetis Project…. Name… boards FRDM-K64

Select KSDK 1.2.0 or KSDK 1.3.0

Select Processor Expert

86047_86047.pngpastedImage_0.png

Set Build Options

Stack Size 0x1000

Heap Size 0x0400


 

Now I find the fsl_usb_framework component from KSDK 1.2.0 or KSDK 1.3.0

and add it to project and inherited components :

Note: is  KSDK 1.2.0 set Baud Rate in  component fsl_debug_console.

 

 

86168_86168.pngpastedImage_1.png

Select usbFmw:fsl_usb_framework Properties Mode and Select Device class driver USBCFG_DEV_CDC Enabled

86169_86169.pngpastedImage_6.png

 

Select usbFmw:fsl_usb_framework Properties Initialization

and Select Auto Initialization Disabled

86170_86170.pngpastedImage_7.png

Click Generate Prosessor Expert Code


  86171_86171.pngpastedImage_8.png

Create New Folger classes

 

86172_86172.pngpastedImage_9.png

Add

Includes Path

"${ProjDirPath}/SDK/usb/usb_core/device/sources/classes/include"

"${ProjDirPath}/SDK/usb/usb_core/device/sources/classes/include/config"

"${ProjDirPath}/SDK/usb/usb_core/device/sources/classes/common"

"${ProjDirPath}/SDK/usb/usb_core/device/sources/classes/cdc"

 

 

 

86173_86173.pngpastedImage_10.png

and Apply.


 

Copy C:\Freescale\KSDK_1.X.0\usb\usb_core\device\sources\classes\

to {ProjDirPath}/SDK/usb/usb_core/device/sources/classes/

folgers:

/cdc

/common

/include

 

86174_86174.pngpastedImage_14.png

 

 

Copy c:\Freescale\KSDK_1.X.0\examples\frdmk64f\demo_apps\usb\device\cdc\virtual_com\

to {ProjDirPath}/Sources/

files

virtual_com.h

usb_descriptor.h

usb_descriptor.c

Note: Not copy virtual_com.c

86175_86175.pngpastedImage_15.png

Next step change main.c based virtual_com.c.

  View attachment projects. 

  Click Generate Prosessor Expert Code.

  Note: function void APP_init(void) different KSDK_1.2.0 and KSDK_1.3.0

If KSDK_1.3.0 add

cdc_config.board_init_callback.callback = NULL ; //usb_device_board_init;

cdc_config.board_init_callback.arg = CONTROLLER_ID;

 

 

Konstantin.

 

Original Attachment has been moved to: CDC_KDS130.ZIP

Original Attachment has been moved to: CDC_KDS120.ZIP

标签 (1)
1 解答
3,927 次查看
andrelemke
Contributor III

I tried to change some configurations on USB libraries of the main project code, and I didn't have sucess.

The solution was very, but very simple. If somebody have the same problem, here is the solution...

The device was detected and the driver update was done too, like in the image below:

pastedImage_0.png

The configuration for the device works on "Termite", is shown below.

We need to set the configurations of the "Flow Control" to RST/CTS.

pastedImage_1.png

Like in these steps:

Yellow: Set the serial COM port referenced by the Virtual Com Port driver (.inf).

Red: Set the Flow Control from "none" to "RTS/CTS".

Green: Press the ok button.

A test  is shown below:

pastedImage_2.png

Comunicacao OK! (Communication OK!)

If ou have your own application software, you need to verify the Flow Control configurations for this applications with the KL27Z series, and it works nice!

Thank you to everyone!

在原帖中查看解决方案

11 回复数
3,927 次查看
grantcazinha
Contributor II

Thank you for posting this.  I'm having an issue with it identifying the USB Device correctly.  I keep getting a "USB Device Not Recognized" error.  Nay idea where I might have gone wrong?

Thank you for your help.

Grant

3,927 次查看
andrelemke
Contributor III

Hi, 

can you check your Build Options on your CPU component ?

Stack Size 0x1000

Heap Size 0x0400

Thanks!

 

0 项奖励
回复
3,927 次查看
grantcazinha
Contributor II

Yes, those are correct.

3,927 次查看
andrelemke
Contributor III

If your clock configurations are correct, remembering that your microntroller needs 48 MHz in the USB peripheral...

Which operating system are you using on your PC ?

0 项奖励
回复
3,927 次查看
grantcazinha
Contributor II

I"m running Windows 7.  I believe my clock settings are correct.  I've setting the clock to 48Mhz and using the USB specific clock with the main clock at it's default settings.  I think the problem is with the clock settings, but I just can't seem to find out where.

3,927 次查看
andrelemke
Contributor III

Maybe you can check if the external clock is configured correctly, like oscillator in low power mode or high gain (requires an external 1 Mohm resistor in parallel with the crystal), depending of your microcontroller. PEE clock mode in 96 MHz and subdivided to 48 MHz for USB functionalities. These are my suggestions, maybe, for solving the problem.

In Windows 7, when the configurations of the microcontroller are wrong, a message pops up in the right side of your screen, like "device malfunction" or "windows doesn't recognized the device". Sometimes these messages are slow to appear. If it's not the case, you have to check if you are using the correct ".inf" file. 

I hope it has helped you,

thanks!

0 项奖励
回复
3,927 次查看
andrelemke
Contributor III

Hi Konstantin!

I followed your steps to implement this application on the KL27Z256VLH4 and it's working fine.

I did some tests with the serial terminal like "Tera Term", "Putty" and I can communicate with no problems.

When I tried to communicate with the "Termite" by  CompuPhase, for example,  or on my own software builded on C++ Builder using the TComPort, the device crashes. The "Termite" and my application does not answer.

Do you know what's happening? The diferences maybe of the implementation of this software to communicate with COM devices? Or the problem can be on the firmware of the microcontroller?

Really thank you for this post, it was so helpful for my academic projects!

0 项奖励
回复
3,928 次查看
andrelemke
Contributor III

I tried to change some configurations on USB libraries of the main project code, and I didn't have sucess.

The solution was very, but very simple. If somebody have the same problem, here is the solution...

The device was detected and the driver update was done too, like in the image below:

pastedImage_0.png

The configuration for the device works on "Termite", is shown below.

We need to set the configurations of the "Flow Control" to RST/CTS.

pastedImage_1.png

Like in these steps:

Yellow: Set the serial COM port referenced by the Virtual Com Port driver (.inf).

Red: Set the Flow Control from "none" to "RTS/CTS".

Green: Press the ok button.

A test  is shown below:

pastedImage_2.png

Comunicacao OK! (Communication OK!)

If ou have your own application software, you need to verify the Flow Control configurations for this applications with the KL27Z series, and it works nice!

Thank you to everyone!

3,927 次查看
henrynguyen
Contributor IV

Hi,

can you please let me know how you could generate the .inf file?

I compile this project and can not get the .inf file at all.

Thanks,

Henry

3,927 次查看
andrelemke
Contributor III

Hi Henry,

you can find the inf. files in the KSDK examples folders. I was using the Kinetis KL27Z microcontroller. In the examples folder there are other suported processors. 

For KSDK 1.2 the directory is: \Freescale\KSDK_1.2.0\examples\frdmkl27z\demo_apps\usb\device\cdc\virtual_com\inf

For KSDK 1.3 the directory is: \Freescale\KSDK_1.3.0\examples\frdmkl27z\demo_apps\usb\device\cdc\virtual_com\inf

0 项奖励
回复
3,927 次查看
wesleyhunter
Contributor II

Thanks for this post, really helpful. I have created a blog post as well on this topic but added how to hook it all up to the fsl_debug_console component which is already supporting CDC but manual initialisation is needed. Check it out at: KSDK USB CDC PRINTF | Centaurian