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

nRF52840 USB example crash

Hi. I've just received my nRF52840-PDK and now I am trying to run usb examples from SDK 13.1.0.

I have started with VisualGDB using arm-eabi toolchain and USB HID Generic example from the SDK. The project built and flashed without errors. But when I connect second USB I get SIGTRAP exception in reent.c on NVIC_Enable_IRQ() in core_cm4.h. Pretty the same as here. The solution in that thread was to change startup files, but don't know how to make it. So this is a question number 1.

I have also tried to flash precompiled .hex files from the SDK, but for every USB example none of my PCs could recognize this USB device. So maybe I need to install some drivers for HID examples?

Other options I have checked, without success:

  • build with GNUARM toolchain from command line as well as from VisualGDB (in case of VisualGDB I had to select software FP instead of hardware, and disable softdevice);
  • build with arm-eabi from VisualGBD using SDK 13.0.0 and 13.1.0.
  • build projects from examples in IAR, not succeeded.

What do I need to do to get working USB on nRF52840?

  • Hi Ilia,

    I suspect hardware issue. Have you tried to use shorter USB cable ? I also have a PDK board that couldn't run any USB examples (USB device not recognized) when other boards worked just fine ( the precompiled hex should work). When we have some more time, I will try to check why that happened.

    For now, I would suggest to test on other board.

  • Hi @hungbui,

    could SIGTRAP exception while debugging be a hardware problem too? What about this thread, I referenced in my question. I have already checked different cables as well as different ports and PCs.

  • Sorry I'm not very familiar with the USB stuff. But what exactly "reent.c" you talked about ? In the case about start up file you pointed to, it's pretty straight forward, he used the wrong start up file , so the interrupt vector was configured wrongly. It's the arm_startup_nrf52840.s start up file.

    Could you described exactly what happens ? If you don't plug the USB in, do you have the issue ? If you plug USB in what exactly happens ? Do you have assertion, hardfault or something ?

    On my board, the code execute with no problem, the only problem is that the PC couldn't recognize it. I assume you are testing with a Windows PC ?

  • Hi @hungbui,

    Situation #1:

    I use HID_Generic example code from the SDK with VisualGDB on Windows PC. I flash and run the code with debugging. Everything is working - the board is just waiting for USB connection. Then I connect the second USB cable and project crashes with exception SIGTRAP in the exact same location as in the referenced thread. And I don't see how to change startup file because in project references there is ".c" startup file and not ".s".

    Situation #2:

    Flash precompiled .hex -> the PC will not recognize the device.

  • Could you send the project you used ? If you have problem with the pre-compiled hex file, I would suspect that it's a hardware issue. Could you try on other PC ? Also if you have another DK please try that also.

Related