I am trying to implement the HAL interface for USB devices in Mbed for the nRF52840. Mbed is currently on nRF SDK14.2 so I may not have all the most recent bug fixes for the USB driver.
I am following the example in examples/peripheral/usbd and am enabling and starting the USBD peripheral using the POWER events. I am encountering an issue where calling nrf_drv_usbd_enable() hangs while waiting for the USBD READY event (see the following lines:https://github.com/AGlass0fMilk/mbed-os/blob/f2df72078397c8305cd57c36046237f7186ce704/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_14_2/drivers_nrf/usbd/nrf_drv_usbd.c#L1706-L1710)
I am also seeing a hardfault on startup if USB is plugged in when I reset the MCU.
You can view my implementation here:
github.com/.../USBPhy_Nordic.cpp
Any insight into why I might be seeing this behavior?