Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 1 month ago.
compile error occurs for USB Device on L4R5ZI
Hello, I get trouble to use USBDevice library on NUCLEO- L4R5ZI board.
When USBDevice library is from mbed_official is used, follow compile error occur Error: Cannot open source input file "USBHAL_STM_TARGET.h": No such file or directory in "USBDevice/targets/TARGET_STM/USBHAL_STM32.cpp", Line: 37, Col: 32
How to use USBDevice library?
Thanks
Question relating to:
![](/media/cache/profiles/ST_logo_2020_blue_V_cmyk.jpg.50x50_q85.jpg)
1 Answer
5 years, 1 month ago.
Hi SH,
Did you see https://os.mbed.com/teams/ST/code/USBDEVICE/?
You can find an example for USBmouse here : https://developer.mbed.org/teams/ST/code/Nucleo_usbmouse/
thanks Daniel,
I already USBDEVICE of ST. (https://os.mbed.com/teams/ST/code/USBDEVICE/) I just did a test of USBmouse example but I got a same error. I seems that the usb library is not supported to the MUCLEO-L4R5ZI. In the USBDEVICE/TARGET_STM/USBHAL_STM_TARGET.h, target is defined but my board is not exist at that file
Thanks.
posted by 29 Jul 2019Yes, I've checked ST's USB DEVICE example code. You're right!. That example code is based on mbed 2. But NUCLEO L4R5ZI was included after Mbed OS 5.11. Furthermore, almost USB API was changed in Mbed OS 5. Let's download the mbed-os-example-blinky
$ mbed import mbed-os-example-blinky
And changing main.cpp to example code's main.cpp of ST(https://os.mbed.com/teams/ST/code/USBDEVICE/). You can successfully compile by MUCLEO-L4R5ZI. Let's try it!
posted by 29 Jul 2019