reset through SWD interface #4
-
Hi,
Doing so I noticed that the reset through the SWD interface didn't work but a power reset did and the application was working as expected. I then started the debugger again and issued a reset command. The same problem appeared, it keeps resetting with the following info;
During these reboots, the debugger isn't able to connect. What can I do to debug this? -Erik. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
I haven't used the SWD interface much but that looks like GDB cannot connect properly. That's not something the firmware on the Pico can influence (which is why you see the same behaviour with the other firmware). |
Beta Was this translation helpful? Give feedback.
-
Ah yes, but I also uploaded a 'blink' example and that flashed without problems and I could reset/debug it through the SWD interface so from that I concluded the cables are all good. Before, I used to pull the usb cable to the pico-probe, which serves as the SWD interface and supplies the power to the target pico. This would reset the target pico correctly but also disconnect the openocd terminal. So I just tested the power reset only on the target pico so the openocd terminal kept working and it is able to restore the debug connection after the power cycle, and then the application is working until I type 'reset'. What could be the difference between the power reset and the reset from the debug interface? are there maybe some watchdog (scratch) registers possibly still set which will trigger the watchdog? |
Beta Was this translation helpful? Give feedback.
-
OK. I managed to find replacements for the submodules and have re-built OpenOCD. I see the same as you. If I comment out the call to initClock() in main(), it seems to work. I'm not entirely sure why yet but the clock initialisation is a cut-down version of the SDK code. The intention was to get the CPU running at full speed to minimise the time it takes to flash any new application but without fiddling with any other clocks that was then pulling in the floating-point library. The full initialisation is done in the application. Maybe when the processor is reset via gdb, it's not resetting all of the various clocks and because the cut-down code is also not re-initialising everything, we end up with some sort of mismatch that then affects the SWD connection. I'll look into it but for now commenting out that call should let you use SWD. |
Beta Was this translation helpful? Give feedback.
-
This is great! I just tested without the initClock() and indeed it works. |
Beta Was this translation helpful? Give feedback.
-
I've created issue #5 for this. I'll leave it to you to decide whether you feel this discussion is now answered or whether you want to wait until the final solution has been determined. |
Beta Was this translation helpful? Give feedback.
-
Again, thanks. To me this is answered. I don't see any problems in leaving the initClock out for now. |
Beta Was this translation helpful? Give feedback.
OK. I managed to find replacements for the submodules and have re-built OpenOCD.
I see the same as you. If I comment out the call to initClock() in main(), it seems to work. I'm not entirely sure why yet but the clock initialisation is a cut-down version of the SDK code. The intention was to get the CPU running at full speed to minimise the time it takes to flash any new application but without fiddling with any other clocks that was then pulling in the floating-point library.
The full initialisation is done in the application. Maybe when the processor is reset via gdb, it's not resetting all of the various clocks and because the cut-down code is also not re-initialising everything, we en…