USB device support bringup for NUCLEO-L432KC

Apologies if this is the wrong forum. What is required to add USB support for a new device? Specific platform is NUCLEO-L432KC.

I looked over the code in the past, but a high level overview of the bringup process from someone who knows what is going on would save me a lot of time.

I never had a NUCLEO-L432KC board, but i already tried to adapt another board to Mbed’s current USB stack. Here you can find the assumptions from Mbed-OS in regard of the USBDevice.

You only have to implement the USBPhyHw.h file for your board, everything else marked with blue comes with Mbed-OS core.

I’m a little confused. If I look for the class you mention I end up at mbed-os/USBPhy_STM32.cpp at master · ARMmbed/mbed-os · GitHub which seems to implement it for all STM parts. Looking for the STM32L432KC part I find pin definitions in mbed-os/PeripheralPins.c at master · ARMmbed/mbed-os · GitHub.

Is the board supported? Where exactly do I place that file?

Took a quick look on the USBPhy_STM32.cpp file and it contains USBPhyHw::endpoint_table(). That means the new USB stack of Mbed is implemented for the STM boards in general. I also see the USBPhyHW.h in that library… i also assume STM would have already noticed if the implementation was broken.

So next i checked targets.json and it seems USBDEVICE is not defined for this board (around line 3327).
This board inherits from MCU_STM32L432xC that inherits from MCU_STM32L4 that inherits from MCU_STM32, but neither of these declare USBDEVICE feature…

If that is the cause, then adding this mbed_app.json to your project root should solve the issue:

"target_overrides": {
         "device_has_add": [