JTAG Error at Inconsistant Locations in Code
I have a ST-Link V2 ISOL for which I have upgraded the firmware to the latest.
The processor is an STM32F373VCT6 on a custom board. I used STM32CubeMX to create the project, and this project includes FREERTOS.
The board is grounded to earth ground to make sure it does not float.
I have installed the STM32-ST Link Utility. It is able to create a connection to the processor.
I am getting an error that causes debugging to halt. The exact line of code it happens on seems to change. It is a moving target. It always happens in the MX_GPIO_Init() function in one of the GPIOx_CLK_ENABLE(); macros where x can can be E,C,F,A,B,or D. This is an area of code that has been generated by STM32CubeMX.
This error is pasted below as it appears in the console tab:
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f3x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f3x.cpu failed, trying to reexamine
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
In an effort to solve this I put in the first lines of the main() function:
HAL_DBGMCU_EnableDBGSleepMode();
HAL_DBGMCU_EnableDBGStopMode();
HAL_DBGMCU_EnableDBGStopMode();
According to http://nuttx.org/doku.php?id=wiki:howtos:jtag-debugging. This did not make a difference.
What has gone wrong here?