USB_Class_CDC_Init()

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USB_Class_CDC_Init()

3,027件の閲覧回数
audi_mcavoy
Contributor IV

Okay, I'll bite.

 

What do I need to include to use USB_Class_CDC_Init()?

 

I created a new, bare metal, FRDM-K64F project.  I used KSDK 1.2 and PEx.  I added an fsl_usb_descriptors component, edited it, and Generated Processor Expert Files.

 

Now I want to call USB_Class_CDC_Init().  The only header file I can find that references it is usb_class_cdc.h, but it declares the function as extern.

extern usb_status USB_Class_CDC_Init(...);

 

I can see that usb_cdc.c actually defines the function; but, usb_cdc.h does not expose it.

 

Since I've already built the demo project, I have a usb_cdc.o available.  How do I tell my project to use it?

- Audi

ラベル(1)
タグ(2)
0 件の賞賛
返信
11 返答(返信)

2,633件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Audi McAvoy,

        Did you add class driver CDC usb_cdc.c  and usb_cdc.h in your project? And add these file's path in your project.

      After you include the usb_cdc.c and usb_cdc.h and it's in your project,  you just need to include the usb_cdc.h, then you can call function USB_Class_CDC_Init().

      For detail usage, you can refer to the ksdk cdc project, which you can find it from path: C:\Freescale\KSDK_1.2.0\examples\frdmk64f\demo_apps\usb\device\cdc\virtual_com\bm\kds

    Wish it helps you!

If you still have question, please contact me!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,633件の閲覧回数
audi_mcavoy
Contributor IV

Hi Jingjing,

Thanks for the reply.

Yes, I did #include usb_cdc.h, and then added the following lines to my Compiler Include Paths

"${PROJECT_KSDK_PATH}/usb/usb_core/device/sources/classes/cdc"

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

The second path resolves a dependency in usb_cdc.h.

I also added the following line to my Linker Library Search paths

"${PROJECT_KSDK_PATH}\usb\usb_core\device\build\kds\usbd_sdk_frdmk64f_bm\debug\usb_core\device\sources\class_driver\cdc"

The above path is where I found usb_cdc.o.

Of course "PROJECT_KSDK_PATH" is defined to point to my KSDK install directory.

When I compile, I get the error "undefined reference to 'USB_Class_CDC_Init."

When I Ctrl-Left-Click on USB_Class_CDC_Init() in my source code I am taken to the declaration in usb_class_cdc.h, which as I mentioned earlier declares it as "extern."  The function seems to be defined in usb_cdc.c; but, usb_cdc.h does not expose it.

Am I just heading in completely the wrong direction by trying to use fsl_usb_descriptors with a CDC class device?  Has anyone else done this?

- Audi

0 件の賞賛
返信

2,633件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Can you upload your error project, I need to check it.

Whether you call the correct items in USB_Class_CDC_Init.

Actually, use extern has no matter, it just mean the function in another file, I already do a small test, define a function then use extern function in the according head file.

After I add the .c file to the project, it doesn't matter.

So, please upload your project, I would like to help you to check it.

0 件の賞賛
返信

2,633件の閲覧回数
audi_mcavoy
Contributor IV

I'm not able to attach a file?

I can insert a picture. . .

pastedImage_0.png

. . .but I cannot attach a file.  I even tried drag/drop.

Am I missing something?  Is there another way I can send my project to you?

0 件の賞賛
返信

2,633件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

1, enter the advanced editor:

pastedImage_0.png

2, in the advanced interface, you will find the attach, then you can attach your project

pastedImage_1.png

0 件の賞賛
返信

2,633件の閲覧回数
audi_mcavoy
Contributor IV

I am starting to believe that you photoshopped your image just to tease me :smileyhappy:.  I honestly cannot find an option to enter the advanced editor mode.

I tried inserting my .zip file as an image; but, I got an error message saying the "image type is forbidden."  I tried renaming the extension to .tif and .bmp.  Both were also forbidden.

NOTE TO JIVE -- Instead of making me (repeatedly) watch a file slowly upload only to tell me it's "forbidden" after completion, how about telling me the type is forbidden before uploading it?

Anyway, I have uploaded my file to Google Drive.  I'll leave it up there for a while, but other readers shouldn't be surprised if it's been deleted in a few months.  Here's the link. . . usb_cdc_tst.zip - Google Drive

0 件の賞賛
返信

2,633件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Audi McAvoy,

      I already help you check it, I find there are several problems in your project.

1. you didn't add the usb_cdc.c in your project, at least I didn't find it in your workspace folder.

2. usb_device_config.h problem, you didn't defined the USBCFG_DEG_CDC in this head file, it is still :

#define USBCFG_DEV_CDC          (0)

You should modify it to :

#define USBCFG_DEV_CDC          (1)

If you didn't define it to 1, it will caused USB_Class_CDC_Init undefined,  you can read the  usb_cdc.c, only when  USBCFG_DEV_CDC is defined as 1, function USB_Class_CDC_Init can be defined.

This is the main problem why you always meet the error of undefined USB_Class_CDC_Init.

3. If still have the undefined function, just add the according head file.

I help you modify your project, the undefined USB_Class_CDC_Init problem is solved,  I also attached it, you can check it.

Besides, I suggest you refer to the KSDK CDC project:C:\Freescale\KSDK_1.2.0\examples\frdmk64f\demo_apps\usb\device\cdc\virtual_com\bm\kdsIn this project, USBCFG_DEG_CDC is defined as 1 in usb_device_config.h

Wish it helps you!

If you still have question, please contact with me!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,633件の閲覧回数
audi_mcavoy
Contributor IV

> #define USBCFG_DEV_CDC         (1)

Ah, ha.  Since my usb_device_config.h was generated by PEx, I have a configuration problem.  I will work on that first.  Then I will work on the dependencies problem.

Thank you very much for your help.

On a side note, I believe you attached a modified file to your last post.  However, it is not shown in my browser.  This is the second time since the Freescale Community hacks that I have not been able to see an attachment.  In my previous experience the original poster (also a Freescale employee) claimed that they could still see their attachment after I told them that I could not.

Here is a screen shot of your post in my Chrome browser. . .

pastedImage_2.png

Maybe you have a contact that you can report this to?  If so, please also tell them that I cannot enter the Advanced Editor or attach a file.

Thank you again!

Have a great day,

- Audi

0 件の賞賛
返信

2,633件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

HI,

  I also tried the chrome browser, on my side, it also can see the attachment:

pastedImage_0.png

Did you try another browser, for example, firefox, IE?

I think this problem may caused by the browser associated with your CPU OS.

You can try another computer, and enter in the community with Chrome browser or other browser.


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,633件の閲覧回数
audi_mcavoy
Contributor IV

Hi Jingjing,

Thanks for the suggestions.  I logged in using Firefox on a completely different computer (same OS though, 64-bit Win7), and I still cannot see your attachment.  It looks the same as my Chrome browser screen shot above.

At this point I have to assume it's a limitation placed on my account.  Do you know who I should contact to look into this?

- Audi

0 件の賞賛
返信

2,633件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Audi McAvoy,

      I already help you to report your attachment problem to our community administrator, she will help you to check, so please wait patiently.


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信