This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB CDC doesn't appear as COM in Release. It's visible only in Debug mode.

Hi,
I wanted to merge two example projects: "ble_central/ble_app_uart_c" so I have central client application, and a "peripheral/ble_usbd_ble_uart" so I have working USB CDC. I need such a combination so I could port it to Dongle with PCA10059 that's gonna be Receiver in my communications system (but first I'm gonna test it on DK that has debugger).

The problem is: when I "Build and Run", USB doesn't appear as a COM in my Windows. Restart button doesn't help. It appears only when I "Build and Debug" and let the program work without step-by-step debugging procedure - "Continue Execution" button in debug perspective of SES. The "peripheral/ble_usbd_ble_uart" example works pretty fine.

I'm under impression it might be some power management problem, but I'm too rookie to figure out. I compared the "sdk_config.h" and "main.c" files and I'm under impression it might work, but it doesn't, so I'm wrong somehow. Maybe that's the lack of some .h or .c files.

In Debug mode, the application catches Hard Fault, I think, because whenever I Pause the Continues Execution, it's stuck there:


And the RealTerm freezes once I open VCOM for USB CDC.

In normal Run, it doesn't catch it, I think, becasue I uncommented one of printf() that send received data via regular J-Link UART, and it works pretty fine, but USB VCOM is not visible.

Parents
  • Hi,

    can you zip and attach the project folder, so I can try building it on my end?

  • Sure, I'ts attached in the link below:

     I'm not sure how to write into registers, as you suggest.

  • I am not able to reproduce the issue. In release, the COM port appears, the restart button works and I get terminal output on the COM port:

    BLE UART central example started.
    -1090482353
    f_addr = 1284
    &f_addr = 537133000
    p_addr = 1284
    *p_addr = -1090482353
    &p_addr = 537133016
    1 = 1
    

    You can try a few things, like an erase all on the board, cleaning the build in SEGGER, updating to the latest nrf command line tools, or moving the project to a fresh SDK install.

  • I guess we misunderstood. The COM you opened is the J-Link one and it works pretty fine. But you need to attach yet another USB cable to a USB nRF, next to Reset button. It should appear as other COM port that crashes for me.

  • Ok, yes I am able to reproduce that. Doesn't seem to have anything to do with debug vs release. Moving app_usbd_power_events_enable() to be after all the init functions, like it is in usbd_ble_uart, makes the COM port show up in release, but doesn't fix the underlying issue of nrf_sdh_enable_request() failing due to an invalid state.

    There is a lot going on here, almost like you are trying to merge the examples in one go. That's bound to cause headaches. I would start over with one of the examples, slowly integrate functions from the other example, and identify and fix issues along the way. Then you can easily point to a single, smaller change which causes issues.

Reply
  • Ok, yes I am able to reproduce that. Doesn't seem to have anything to do with debug vs release. Moving app_usbd_power_events_enable() to be after all the init functions, like it is in usbd_ble_uart, makes the COM port show up in release, but doesn't fix the underlying issue of nrf_sdh_enable_request() failing due to an invalid state.

    There is a lot going on here, almost like you are trying to merge the examples in one go. That's bound to cause headaches. I would start over with one of the examples, slowly integrate functions from the other example, and identify and fix issues along the way. Then you can easily point to a single, smaller change which causes issues.

Children
Related