cancel
Showing results for 
Search instead for 
Did you mean: 

i tried to send a message to my pc using USB CDC . i get a error : error: 'hUsbDeviceFS' undeclared (first use in this function) but the 'hUsbDeviceFS' is defined in the usb_devise.c

HBahr
Associate
 
1 ACCEPTED SOLUTION

Accepted Solutions

hi,

i just found a solution. i was using the STM32L496G-DICO.i was trying to preform the example project in the MOOC training provided by st "STM32L4 hands-on-sessions".

"https://www.st.com/content/st_com/en/support/learning/stm32-education/stm32-moocs/stm32cubemx-and-cubeHhal-basics.html"

you can see vedio number 35 if you want to know exactly what i was doing.

the problem was that  a error accured when compiling "the usb handler hUsbDeviceFS is not defined"  . But when i reviewed the project structures it was defined in one of the includes….

i just Added hUsbDeviceFS as a global variable in the main ( I added this line : USBD_HandleTypeDef hUsbDeviceFS; ) and every think worked fine.

Kind Regards,

Hamza

View solution in original post

3 REPLIES 3
Imen.D
ST Employee

Hello,

Could you please give us more details on your environment and which device are you using? Are you usig CubeMX or example from Cube firmware package and which versions?

Maybe, you should review the structure of the projects provided in the Templates of CUbe package for supported tool chains, and map them to yours.

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

hi,

i just found a solution. i was using the STM32L496G-DICO.i was trying to preform the example project in the MOOC training provided by st "STM32L4 hands-on-sessions".

"https://www.st.com/content/st_com/en/support/learning/stm32-education/stm32-moocs/stm32cubemx-and-cubeHhal-basics.html"

you can see vedio number 35 if you want to know exactly what i was doing.

the problem was that  a error accured when compiling "the usb handler hUsbDeviceFS is not defined"  . But when i reviewed the project structures it was defined in one of the includes….

i just Added hUsbDeviceFS as a global variable in the main ( I added this line : USBD_HandleTypeDef hUsbDeviceFS; ) and every think worked fine.

Kind Regards,

Hamza

I think this should be more correct. Since it's already declared in the usb_device.c

 extrern USBD_HandleTypeDef hUsbDeviceFS;