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

nRF52840 does not enumerate as USB CDC unless power cycled after download and run from IAR Workbench but works correctly when using Ozone

Hi,

We have a custom board that uses an nRF52840.  All our development is done on Win 10 based PCs.  Our custom board is connected to our Win 10 based PC via USB and when everything is working then we get a virtual COM port connection to our board. Our normal build and debug environment is the IAR Workbench.  We use both the latest 8.42.2 version and older versions and we have the same problem.  We use J-Link SWD adapters to attach to our board. The J-Link FW is updated to the latest version that was released on 2020Jan07. The reset line from the J-Link is connected to the nRF but it makes no difference for the problem described below if the rest line is or is not connected.  We do not provide power to our board from the J-Link.  The J-Link is connected to VTREF and the J-Link is always able to see the correct voltage on VTREF.

Our normal workflow is to compile, download and debug, then run (i.e. press F5) from within the IAR Workbench.  However when we do this the nRF is not enumerated on the USB bus.  The nRF starts running and the code is executed but the USB driver from the SDK is stuck in an error loop showing a USB Event is not ready error. (Note: I will try to get the exact error and add it to this posting later.)   We have to power cycle our board in order for it to be enumerated and detected by the PC.  Power cycling is done with the J-Link connected.  After we power cycle then we attach the IAR debugger to a running application and we can debug without any issues.

When we use the Segger Ozone debugger (V3.10d and also an older version) then we can take the same exact .hex or .out files and select "Download & Reset".  Then when we select run from the debugger our device is enumerated on the USB bus without any problem.  We do not have to add the additional step of power cycling our board.

This leads me to believe that the problem is due to the way that IAR is resetting or more correctly not resetting the nRF after it downloads and programs the binary into flash.

In the IAR Debugger "Setup" tab we have "Run to main" selected. We tried disabling this option and we still have the same problem.  The "Download" tab has "Use flash loader(s)" selected. 

Looking for some help to resolve this IAR configuration problem because it is impacting our workflow and causing extra delays every time we download new code to the nRF.

Thanks,

Raz

Related