Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


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.Question This did not make a difference.

What has gone wrong here?

France

Hi,

As the error occurs when you are initializing the GPIOs, could you check that you do not modify by error one of the pins used by your debug link (JTAG or SW)?

Bernard (Ac6)


Pasted below is the information copied from STM32CubeMX’s Pin Configuration’s SYS tab:
PA13 SYS_JTMS-SWDIO n/a n/a n/a n/a false
PA14 SYS_JTCK-SWCLK n/a n/a n/a n/a false
PA15 SYS_JTDI n/a n/a n/a n/a false
PB3 SYS_JTDO-TRACESWO n/a n/a n/a n/a false
PE2 SYS_TRACECK Alternate Function Push Pull No pull up pull down Low n/a false
PE3 SYS_TRACED0 Alternate Function Push Pull No pull up pull down Low n/a false
PE4 SYS_TRACED1 Alternate Function Push Pull No pull up pull down Low n/a false
PE5 SYS_TRACED2 Alternate Function Push Pull No pull up pull down Low n/a false
PE6 SYS_TRACED3 Alternate Function Push Pull No pull up pull down Low n/a false

The proper JTAG assignments appear to have been done in STM32CubeMX. However in the code that STM32CubeMX generated the JTAG error I get does happen when GPIOA is configured. Here is that code:

/*Configure GPIO pins : PAPin PAPin */
GPIO_InitStruct.Pin = Test_PointA2_Pin|Test_PointA9_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

There is no change made to pins PA13, PA14, or PA15 here. But it is suspicious that it happens when changes to pins on this port that contains these JTAG pins are are done.

When the above is commented out I find the JTAG error also happens here:

/*Configure GPIO pin : PB10 */
GPIO_InitStruct.Pin = GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

Once again it happens when a port that contains JTAG pins has one of its non JTAG pins changed.

But it also happens here:

/*Configure GPIO pins : PBPin PBPin PBPin PBPin */
GPIO_InitStruct.Pin = PWM2_TIM15_Ch1_Alternate_Pin|PWM2_TIM15_Ch1N_Alternate_Pin|JTAG_TRST_Pin|USART_INVALID_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

Which does change a JTAG pin. Obviously the ST-Link V2 ISO is functioning up to this point, so I see no reason for STM32CubeMX to assign these JTAG pins. Should I remove all the JTAG pin assignments from the STM32CubeMX project file?


I have removed the JTAG assignments from the STM32CubeMX project file, and instead assigned them the Reset_State. I then regenerated the code and found this code in fhe function MX_GPIO_Init():

GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

I also see similar code for GPIOB pins GPIO_PIN_3 and GPIO_PIN_4

After either of this code is executed I get an ST-Link V2 communication failure. I do not want to have to comment out this code or delete it whenever I regenerate code in STM32CubeMX. Is there a way to prevent STM32CubeMX including pin configuration for these three pins?


Hi, I have a nucleo stm32f103rb. I wanted to flash the compiled .bin file on the board. (Debug) Every time comes an error:

Open On-Chip Debugger 0.10.0-dev-00302-gc211ca5-dirty (2017-07-03-10: 41)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.htmlQuestion
Srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info: The selected transport took over low-level target control. The results might differ from JTAG / SWD
Adapter speed: 950 kHz
adapter_nsrst_delay: 100
Info: clock speed 950 kHz
Error: libusb_open () failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: libusb_open () failed with LIBUSB_ERROR_NOT_SUPPORTED
Info: STLINK v2 JTAG v28 API v2 M v17 VID 0x0483 PID 0x374B
Info: using stlink api v2
Info: Target voltage: 3.254104
Info: STM32F103RBTx.cpu: hardware has 6 breakpoints, 4 watchpoints
Info: accepting ‘gdb’ connection on tcp / 3333
Adapter speed: 950 kHz
STM32F103RBTx.cpu: targetState: halted
target halted due to debug-request, currentMode: Thread
X PSR: 0x01000000 pc: 0x0800021c msp: 0x20005000
Adapter speed: 4000 kHz
Info: device id = 0x20036410
Info: flash size = 128kbytes
Adapter speed: 950 kHz
STM32F103RBTx.cpu: targetState: halted
target halted due to debug-request, currentMode: Thread
X PSR: 0x01000000 pc: 0x0800021c msp: 0x20005000
Adapter speed: 950 kHz
STM32F103RBTx.cpu: targetState: halted
target halted due to debug-request, currentMode: Thread
X PSR: 0x01000000 pc: 0x0800021c msp: 0x20005000
Adapter speed: 4000 kHz
STM32F103RBTx.cpu: targetState: halted
target halted due to breakpoint, currentMode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20005000
Adapter speed: 950 kHz
STM32F103RBTx.cpu: targetState: halted
target halted due to debug-request, currentMode: Thread
X PSR: 0x01000000 pc: 0x0800021c msp: 0x20005000
Info: rejected ‘gdb’ connection, no more connections allowed
Error: jtag status contains invalid mode value - communication failure
Polling target STM32F103RBTx.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info: Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target STM32F103RBTx.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info: Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target STM32F103RBTx.cpu failed, trying to reexamine

Can anybody help me?