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.

Parents Reply
  • Hi,

    I did face that issue described in the link as I was previously using SES v3.40. Now I have downgraded to SES 3.34b, and no longer facing compile problems due to the _putchar() function.

    However the issue still persists, and only happens when I include USB functionalities in the code. I am also running an NFC launch app function, and what's weird is that the NFC works on power up(without having to run in debug), which tells me that the code is running, but the USB fails to enumerate. It only enumerates if I force to run in debug, which might or might not be related to the issue in the link.

    I will try out the workaround in the link which is intended for SES v3.40, and let you know of my result.

    Thanks for your support!

Children
  • Any progress on this? I am having a similar problem which I documented here:

    https://devzone.nordicsemi.com/f/nordic-q-a/37812/usb-not-enumerating-without-jlinkexe-running

    I know my application is running because my custom hardware has an OLED screen which works, and my BLE functionality is working.

    My device does not enumerate over USB unless I have JLinkExe connected with J-Link Pro over SWD. If I simply run JLinkExe and type "connect" to the running application, the USB immediately enumerates. I do not have to physically disconnect the JLink Pro from SWD to see the lack of enumeration (or the subsequent enumeration when using JLinkExe and"connect").

    No amount of connecting/disconnecting a USB cable works with JLinkExe "disconnected" but once JLinkExe is running, I can connect/disconnect a USB cable repeatedly and get enumeration reliably.

Related