This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE NUS central + USB (usb not enabled on power detection)

Hi all,

I'm trying to combine the BLE NUS central with USB CDC functionality.

I have copied over functions from the USB CDC ACM example into the BLE_APP_UART central example. 

I have enabled all the relevant USB modules in sdk_config.h

Upon flashing, the BLE NUS central functions work well. However as soon as I connect the nRF USB, the program hangs immediately.

I discovered that this issue is due to the USB peripheral waiting to be enabled upon receiving the power detection event.

This is the loop below.

while (0 == (NRF_USBD_EVENTCAUSE_READY_MASK & nrf_usbd_eventcause_get()))
{
/* Empty loop */
}

So it seems that EVENTCAUSE is always 0 and the loop never ends.

I'm using SES with SDK15, which already has the errata fixes implemented, so I'm quite unsure why this issue still persists.

However, I found out that I can make my code work by first flashing the usb_cdc_acm example, then flashing my actual modified code.

It works until I reflash it again. Then I would need to repeat the procedure.

I'm testing this using a custom PCB with the rev1 QIAA-C0 variant, as I have a non-working USB V0.92 PCA10056.

Any help appreciated. I can provide the SES project file if needed.

Related