NRF5340 Seems to flash, but fails to debug using VSC

Hello,

I am having issues debugging my nRF5340 chip using VS code. When I flash, there is no indication that it fails from the console. When I try to debug however, my debugger launches but is always paused. When I try to step through or step out, I get an error saying "Unable to step out. Operation failed with error code 0x80004004."

A few notes on what I've tried:

  • Using SDK version 2.2.0
  • Verified that my chip is receiving 3 volts
  • Different combinations of the following in my prj.conf:
    • CONFIG_DEBUG_OPTIMIZATIONS=y
    • CONFIG_DEBUG_THREAD_INFO=y
    • CONFIG_BOARD_ENABLE_CPUNET=y
    • CONFIG_UART_CONSOLE=n
  • Using different projects
    • One given to us from the distributor, and the "empty_app_core" sample.
  • Using a separate dev kit

One additional thing to note, I have to erase flash memory every time I try to flash. There's an error that says "Flashing failed due to protection on the device.". I'm not convinced that this is my issue, as using the Programmer tool in nRF connect shows that the memory is no longer protected after having erased flash. The error also goes away when I try to debug after erasing. It comes back however if I reboot the kit.

Since I'm using VSC, I don't know how to use --restore in the command line for west. I also haven't found out how to use something similar in my config files.

Info on the kit I'm using (LN60E40F):

https://www.fanstel.com/ln60e40f

Thank you

Parents
  • I actually just got it to work in a very janky way. Seems somewhat reliably reproduceable. I can begin debugging if I do the following:

    1. Get the debugger to launch and leave it open
    2. Reboot the kit
    3. While the debugger is still on, launch the debugger again
    4. VSC will ask if it can erase flash memory, say yes. If you don't get the prompt, it doesn't seem to work
    5. Press play on the debugger. Step through won't work, but pausing again will stop the program and show your cursor in the program.

    Still a pretty painful process, and I don't think that break points work with this method.

Reply
  • I actually just got it to work in a very janky way. Seems somewhat reliably reproduceable. I can begin debugging if I do the following:

    1. Get the debugger to launch and leave it open
    2. Reboot the kit
    3. While the debugger is still on, launch the debugger again
    4. VSC will ask if it can erase flash memory, say yes. If you don't get the prompt, it doesn't seem to work
    5. Press play on the debugger. Step through won't work, but pausing again will stop the program and show your cursor in the program.

    Still a pretty painful process, and I don't think that break points work with this method.

Children
Related