MCUboot/HCI-USB bug #hci #mcuboot #nrf52


mhamel@...
 

I believe I have found a bug in the current HCI-USB code for the nRF52 series when it is started from the MCUboot bootloader. This is on the current Zephyr 2.6 branch.
In usb_dc_nrfx.c, usb_dc_attach() there is provision for dealing with the absence of a NRFX_POWER_USB_EVT_DETECTED when starting up from a USB bootloader, by generating such an event. This eventually calls nrfx_usbd.c, usbd_enable(). This code hangs in usbd_eventcause_wait_and_clear(NRF_USBD_EVENTCAUSE_READY_MASK), waiting for a ready state that never occurs.
What seems to have recently changed is that the USB driver comes up in the NRFX_POWER_USB_STATE_READY state, not NRFX_POWER_USB_STATE_CONNECTED.
My workaround for this problem is to edit nrfx_usbd.c to add

if (nrfx_power_usbstatus_get() != NRFX_POWER_USB_STATE_READY)

just before the call to usbd_eventcause_wait_and_clear(), but although this seems to fix the problem I have no idea whether its the right solution or not.

Join users@lists.zephyrproject.org to automatically receive all group messages.