|
From: Pau C <pub...@gm...> - 2025-01-08 14:46:38
|
Dear all, I am trying to program the relatively new PIC32CZ using an Atmel-ICE SWD debugger. I compiled openocd from the default branch (0.12.0+dev-00825-g250ab1008) I am getting a "timed out while waiting for target halted" error when GDB attempts to reset and halt the device, however if I manually issue monitor halt, I am able to halt the CPU. My ultimate goal is to use PlatformIO with this MCU. I identified I need to add a Flash driver to openocd for this MCU Family, and create a new .cfg script. I would also like to contribute this to openocd if I manage to create something useful. But first, I would like the normal PlatformIO debugging initialization to work. Detailed description of the problem: The PIC32CZ8110CA90208 (Cortex M7) is in a custom board, with correct voltages. The Atmel-ICE is connected to its SWD interface. I start openocd with ./src/openocd -d3 -s "/mnt/c/Users/polivera/.platformio/packages/tool-openocd/openocd/scripts" -f "interface/cmsis-dap.cfg" -c "set CHIPNAME pic32cz8110ca90208" -f "target/pic32cz.cfg" (.cfg Attached) The result is attached in pic32cz_openocd_init.txt. It seems alright. I also see in the Logic Analyzer SWD correct communication. I start PlatformIO which in turn starts GDB and issues some monitor comands. One of this comands is "monitor reset halt". After this, the device is reset (confirmed by probing the NRST line near the chip). Then it seems like openocd is waiting for a state to become "halted". However this never hapens. See pic32cz_openocd_after_platformio_debug.txt. In the Logic Analyzer I see SWD polling until openocd gives up. I tried changing the timeout from 1000 to 5000 ms, and changing the reset method. The result is the same. If I manually do "monitor reset" and then "monitor halt" in the GDB console, it works. If I do "monitor reset halt", it times out. This command is used during the programming sequence, so I think I need it to work. I can "monitor resume" and then repeat the problem always. (See manual_gdb_comands.txt and pic32cz_openocd_after_manual_gdb_commands.txt) Any advice or help would be very much appreciated, I am a newbie. In the meantime, I am working on the Flash driver, but I think I should be able to at least get the device initialized before I am able to test it. Thanks in advance, Pau |