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

USB not enumerating without JLinkExe running

Hi,

I am having a problems with USB enumerating with a custom board based on the nRF52840. The board is self powered by LiPo battery. I am developing by connecting to the board with a J-Link Pro over SWD. I am using the armgcc toolchain. My application is SDK 15 based and implements a BLE peripheral and I'm trying to support a USB virtual com port. My applications BLE functionality is working great. I am able to see NRF_LOG_INFO print outs.

Using USBD CDC, I am able to connect my device over USB to my Macbook Pro and send/receive bytes to my application over USB using app_usbd_cdc_acm_write() and receiving in my cdc_acm_user_ev_handler().

I am able to plug and un-plug the USB cable and I see the /dev/tty.usbmodem**** appear and disappear and I receive related events in my cdc_acm_user_ev_handler().  After disconnect/reconnect, I am continue to be able to send/receive bytes to my application over USB.

The problem comes when I quit JLinkExe (regardless of leaving the J-Link Pro connected to the target):

When I quit JLinkExe, my Mac and the target continue to be able to communicate over USB, however if I disconnect the USB cable, and reconnect, I can not get the device to re-enumerate no matter how many times I unplug and re-plug the cable.

If I relaunch JLinkExe, and type "connect", I immediately see my custom board enumerating on the Mac.

I read the following threads:

https://devzone.nordicsemi.com/f/nordic-q-a/37217/ble-nus-central-usb-usb-not-enabled-on-power-detection

https://devzone.nordicsemi.com/f/nordic-q-a/37477/unable-to-run-uart-ble-app-example-without-debugger

And I updated the erreta to 0x20, but my application does not link retarget.c so I don't understand the __putchar signature change. I tried making that change and adding retarget.c, but it does not get used by the linker (and results in no change). I disabled logging with NRF_LOG_ENABLED, and I no longer see any printouts via JLinkRTTClient, but I still have the same failure to enumerate if JLinkExe is not connected.

Any ideas?

Thanks!

Jeremy

Parents
  • So my custom board has an OLED screen. I am printing out status to it, and I can see that when JLinkExe is not connected, and my device fails to enumerate USB, it is still getting all the way to the 'APP_USBD_EVT_POWER_READY' event in my usbd_user_ev_handler() despite failing to enumerate. I correctly see 'APP_USBD_EVT_POWER_REMOVED' through 'APP_USBD_EVT_POWER_READY' events when I unplug and plug back in the USB cable, but no device enumeration (i.e. /dev/tty.usbmodem*** does not show up)...until...I connect again with JLinkExe, then I get device enumeration.

    In the working case, the last event I get after successful enumeration is "APP_USBD_EVT_DRV_RESET".

    In the case where JLinkExe is disconnected (and it fails to enumerate), I alternate between getting "APP_USBD_EVT_DRV_SUSPEND" and "APP_USBD_EVT_DRV_RESUME" events but never get to the "APP_USBD_EVT_DRV_RESET" state.

Reply
  • So my custom board has an OLED screen. I am printing out status to it, and I can see that when JLinkExe is not connected, and my device fails to enumerate USB, it is still getting all the way to the 'APP_USBD_EVT_POWER_READY' event in my usbd_user_ev_handler() despite failing to enumerate. I correctly see 'APP_USBD_EVT_POWER_REMOVED' through 'APP_USBD_EVT_POWER_READY' events when I unplug and plug back in the USB cable, but no device enumeration (i.e. /dev/tty.usbmodem*** does not show up)...until...I connect again with JLinkExe, then I get device enumeration.

    In the working case, the last event I get after successful enumeration is "APP_USBD_EVT_DRV_RESET".

    In the case where JLinkExe is disconnected (and it fails to enumerate), I alternate between getting "APP_USBD_EVT_DRV_SUSPEND" and "APP_USBD_EVT_DRV_RESUME" events but never get to the "APP_USBD_EVT_DRV_RESET" state.

Children
No Data
Related