Skip to main content
ECrom.1
Associate III
January 28, 2020
Solved

USB CDC USBD_CDC_SetTXBuffer and USBD_CDC_Transmit_Packet

  • January 28, 2020
  • 5 replies
  • 2409 views

Hi all,

I am trying the example of USB CDC in:

https://www.youtube.com/watch?v=rLnQ3W8gmjY&list=PLnMKNibPkDnEEvQWrDqVuu1w_iQ214GXi&index=35

It uses the above functions.

But when I compile, I get :

undefined reference to `USBD_CDC_SetTXBuffer' and to  USBD_CDC_Transmit_Packet

Can someone help ?

Thanks

Eli

This topic has been closed for replies.
Best answer by Bob S

Is this a COMPILE error, or a LINKER error?

Didn't look at the video, but presuming you started with CubeMX (or the IDE embedded version of this), those functions usually reside in usbd_cdc.h and usbd_cdc.c, located in

YOUR_PROJECT_DIR\Middlewares\ST\STM32_USB_Device_Library\CDC\Inc and \Src

If those files exist in your project directory, perhaps the IDE is not configured to look in those directories for files. Presuming you are using an Eclipse-based IDE, rIght-click on the project in the "Project Explorer" window, expand "C/C++ Build" and click on "Settings". In the "Tool Settings" tab, click on "Includes" under "MCU GCC Compiler". You should see a list of directories that the compiler searches for .h files. Make sure the above directory is listed.

5 replies

Bob S
Bob SBest answer
Super User
January 28, 2020

Is this a COMPILE error, or a LINKER error?

Didn't look at the video, but presuming you started with CubeMX (or the IDE embedded version of this), those functions usually reside in usbd_cdc.h and usbd_cdc.c, located in

YOUR_PROJECT_DIR\Middlewares\ST\STM32_USB_Device_Library\CDC\Inc and \Src

If those files exist in your project directory, perhaps the IDE is not configured to look in those directories for files. Presuming you are using an Eclipse-based IDE, rIght-click on the project in the "Project Explorer" window, expand "C/C++ Build" and click on "Settings". In the "Tool Settings" tab, click on "Includes" under "MCU GCC Compiler". You should see a list of directories that the compiler searches for .h files. Make sure the above directory is listed.

ECrom.1
ECrom.1Author
Associate III
January 29, 2020

Hi and thanks for the reply

It is a compile error

And I am working with STM CUBE

Eli

ECrom.1
ECrom.1Author
Associate III
January 29, 2020

found the problem. Thanks

The compiler did not include the USB include file for some reason, although it is in the tree

I included it manually, and works fne

Thanks again

Eli

ARodr.2
Visitor II
April 12, 2020

Eli,

How did you include it manually?

I'm having the same issue.

please provide more details.

thanks in advance

ARodr.2
Visitor II
April 12, 2020

Eli,

How did you include it manually?

I'm having the same issue.

please provide more details.

thanks in advance