I’m
having problems reading or writing to flash for debugging. I’d appreciate any help on how to
troubleshoot the problem.
We have three development boards. The two I’ve been using have the problem
persistently. The third is used by
another engineer. The third board had
similar problems intermittently, but now appears fine. The good board works at both of our
workstations. The bad boards fail at
both workstations.
The bad boards worked for a few hours at my workstation, straight out of the box from the vendor. Then they failed after an arbitrary round of modifying trivial code and attempting to debug.
I’m using:
- a STM32303C-EVAL board with a STM32F303VC processor
- IAR Embedded Workbench version 6.50.6.4958
- J-Link ARM V4.78j
- J-Trace CM (physical label reports 3.2, J-Link configurator reports product version CS V3.10)
I’m
also using example code for this problem report. The example code is stm32f30x_dsp_stdperiph_lib\STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\EWARM\Project.eww
I modified the example code with the following IAR menu options:
- Project -> Options -> Debugger -> Setup -> Driver -> J-Link/J-Trace
- Project -> Options -> Debugger -> Download -> Verify Download
- Project -> Options -> Debugger -> J-Link/J-Trace -> Reset -> Core and Peripherals
I have tried both checking and unchecking this IAR menu option:
- Project -> Options -> Debugger -> Download -> Use flash loader(s)
Now for the play-by-play. I performed more steps than usual in this example to better illustrate the problem.
1) Power up the board from a powered USB hub
2) Power up the J-Trace probe
3) Run “J-Link STM32 Unlock” to re-initialize the processor. It did not report any errors. This is the output:
===start snip ===
SEGGER
J-Link Unlock tool for STM32 devices
Compiled
Nov 22 2013 20:08:51
(c) 2009 SEGGER Microcontroller GmbH & Co. KG, segger.com Solutions for real time microcontroller applications
Connecting
to J-Link...O.K.
Using SWD as target interface.
Target interface speed: 1000kHz.
STM32F302/303 device identified.
Revision: Y
Reset target...O.K.
Reset option bytes to factory settings...O.K.
Press any key to exit.
=== end snip ===
4) Run “J-Link commander”, enter commands “device stm32f303vc” and “erase”. The tool reports:
WARNING: CPU is running at low speed (8033 kHz)
****** Error: Failed to erase sectors 0 @ address 0x08000000 (erase error)
This is the full output:
=== start snip ===
C:\Users\dmiller>"C:\Program Files (x86)\SEGGER\JLinkARM_V478j\JLink.exe"
SEGGER J-Link Commander V4.78j ('?' for help)
Compiled Nov 22 2013 20:08:49
DLL version V4.78j, compiled Nov 22 2013 20:08:33
Firmware: J-Trace Cortex-M Rev.3 compiled Jun 27 2013 09:39:48
Hardware: V3.10
S/N: 203200451
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Emulator has RAWTRACE capability
VTarget = 3.280V
Info: TotalIRLen = 9, IRPrint = 0x0011
Info: Found Cortex-M4 r0p1, Little endian.
Info: FPUnit: 6 code (BP) slots and 2 literal slots
Info: TPIU fitted.
Info: ETM fitted.
Found 2 JTAG devices, Total IRLen = 9:
#0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
#1 Id: 0x06422041, IRLen: 05, IRPrint: 0x1, STM32 Boundary Scan
Cortex-M4 identified.
Target interface speed: 100 kHz
J-Link>device stm32f303vc
Info: Device "STM32F303VC" selected (256 KB flash, 32 KB RAM).
Reconnecting to target...
Info: TotalIRLen = 9, IRPrint = 0x0011
Info: TotalIRLen = 9, IRPrint = 0x0011
Info: Found Cortex-M4 r0p1, Little endian.
Info: FPUnit: 6 code (BP) slots and 2 literal slots
Info: TPIU fitted.
Info: ETM fitted.
J-Link>erase
Erasing device (STM32F303VC)...
WARNING: CPU is running at low speed (8033 kHz).
****** Error: Failed to erase sectors 0 @ address 0x08000000 (erase error)
Info: J-Link: Flash download: Total time needed: 41.283s (Prepare: 0.685s, Compare: 40.467s, Erase: 0.051s, Program: 0.000s, Verify: 0.000s, Restore: 0.080s)
Erasing done.
J-Link>
=== end snip ===
5) “Download and debug” from IAR with “Use flash loader(s)” checked.
The following error was displayed:
Warning:
There were warnings during download, see Log Window
[img]file:///C:\Users\dmiller\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png[/img]
=== start snip from Log window ===
Tue Jan 07, 2014 12:14:59: Loaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\config\flashloader\ST\FlashSTM32F3xx.mac
Tue Jan 07, 2014 12:15:00: JLINK command: ProjectFile = C:\DennisM\Downloads\stm32f30x_dsp_stdperiph_lib_20140106_1523_cleanish\STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\EWARM\settings\Project_STM32303C-EVAL.jlink, return = 0
Tue Jan 07, 2014 12:15:00: Device "STM32F303VC" selected (256 KB flash, 32 KB RAM).
Tue Jan 07, 2014 12:15:00: DLL version: V4.78j, compiled Nov 22 2013 20:08:33
Tue Jan 07, 2014 12:15:00: Firmware: J-Trace Cortex-M Rev.3 compiled Jun 27 2013 09:39:48
Tue Jan 07, 2014 12:15:00: JTAG speed is initially set to: 32 kHz
Tue Jan 07, 2014 12:15:00: TotalIRLen = 9, IRPrint = 0x0011
Tue Jan 07, 2014 12:15:00: TotalIRLen = 9, IRPrint = 0x0011
Tue Jan 07, 2014 12:15:00: Found Cortex-M4 r0p1, Little endian.
Tue Jan 07, 2014 12:15:00: FPUnit: 6 code (BP) slots and 2 literal slots
Tue Jan 07, 2014 12:15:00: TPIU fitted.
Tue Jan 07, 2014 12:15:00: ETM fitted.
Tue Jan 07, 2014 12:15:01: Hardware reset with strategy 0 was performed
Tue Jan 07, 2014 12:15:01: Initial reset was performed
Tue Jan 07, 2014 12:15:01: Found 2 JTAG devices, Total IRLen = 9:
Tue Jan 07, 2014 12:15:01: #0 Id: 0x4BA00477, IRLen: 4, IRPrint: 0x1 CoreSight JTAG-DP
Tue Jan 07, 2014 12:15:01: #1 Id: 0x06422041, IRLen: 5, IRPrint: 0x1 STM32 Boundary Scan
Tue Jan 07, 2014 12:15:02: -I- execUserFlashInit!
Tue Jan 07, 2014 12:15:02: -I- Hardware watchdog
Tue Jan 07, 2014 12:15:02: 480 bytes downloaded and verified (10.19 Kbytes/sec)
Tue Jan 07, 2014 12:15:02: Loaded debugee: C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\config\flashloader\ST\FlashSTM32F3xxRAM32K.out
Tue Jan 07, 2014 12:15:02: Target reset
Tue Jan 07, 2014 12:15:02: Downloaded C:\DennisM\Downloads\stm32f30x_dsp_stdperiph_lib_20140106_1523_cleanish\STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\EWARM\STM32303C-EVAL\Exe\STM32303C-EVAL.out to flash memory.
Tue Jan 07, 2014 12:15:02: Loaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\config\debugger\ST\Trace_STM32F3xx.dmac
Tue Jan 07, 2014 12:15:02: Hardware reset with strategy 0 was performed
Tue Jan 07, 2014 12:15:02: 18596 bytes downloaded into FLASH and verified (41.56 Kbytes/sec)
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000000, target byte: 0x00, byte in file: 0x50
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000001, target byte: 0x00, byte in file: 0x06
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000003, target byte: 0x00, byte in file: 0x20
=== repeated errors removed ===
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000128, target byte: 0x00, byte in file: 0xF5
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000129, target byte: 0x00, byte in file: 0x47
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x0800012B, target byte: 0x00, byte in file: 0x08
Tue Jan 07, 2014 12:15:02: Warning: Too many verify errors, only the first 200 are displayed
Tue Jan 07, 2014 12:15:22: Warning: There were warnings during download, see Log Window
Tue Jan 07, 2014 12:15:22: Loaded debugee: C:\DennisM\Downloads\stm32f30x_dsp_stdperiph_lib_20140106_1523_cleanish\STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\EWARM\STM32303C-EVAL\Exe\STM32303C-EVAL.out
Tue Jan 07, 2014 12:15:22: Hardware reset with strategy 0 was performed
Tue Jan 07, 2014 12:15:22: Target reset
Tue Jan 07, 2014 12:15:23: There was 1 warning during the initialization of the debugging session.
=== end snip ===
6) “Download and debug” from IAR with “Use flash loader(s)” unchecked.
The following error was displayed:
Failed to erase sectors 0 @ address 0x08000000 (erase error). Abort debug session?
[img]file:///C:\Users\dmiller\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png[/img]
I’ve
also seen these errors during other attempts:
Programming failed @ address 0x08012800 (block verification error). Abort debug session?
Warning: Stack pointer is setup to incorrect alignment. Stack addr = 0xAAAAAAAA
[img]file:///C:\Users\dmiller\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png[/img]
[img]file:///C:\Users\dmiller\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png[/img]
End
of excessively detailed report.
having problems reading or writing to flash for debugging. I’d appreciate any help on how to
troubleshoot the problem.
We have three development boards. The two I’ve been using have the problem
persistently. The third is used by
another engineer. The third board had
similar problems intermittently, but now appears fine. The good board works at both of our
workstations. The bad boards fail at
both workstations.
The bad boards worked for a few hours at my workstation, straight out of the box from the vendor. Then they failed after an arbitrary round of modifying trivial code and attempting to debug.
I’m using:
- a STM32303C-EVAL board with a STM32F303VC processor
- IAR Embedded Workbench version 6.50.6.4958
- J-Link ARM V4.78j
- J-Trace CM (physical label reports 3.2, J-Link configurator reports product version CS V3.10)
I’m
also using example code for this problem report. The example code is stm32f30x_dsp_stdperiph_lib\STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\EWARM\Project.eww
I modified the example code with the following IAR menu options:
- Project -> Options -> Debugger -> Setup -> Driver -> J-Link/J-Trace
- Project -> Options -> Debugger -> Download -> Verify Download
- Project -> Options -> Debugger -> J-Link/J-Trace -> Reset -> Core and Peripherals
I have tried both checking and unchecking this IAR menu option:
- Project -> Options -> Debugger -> Download -> Use flash loader(s)
Now for the play-by-play. I performed more steps than usual in this example to better illustrate the problem.
1) Power up the board from a powered USB hub
2) Power up the J-Trace probe
3) Run “J-Link STM32 Unlock” to re-initialize the processor. It did not report any errors. This is the output:
===start snip ===
SEGGER
J-Link Unlock tool for STM32 devices
Compiled
Nov 22 2013 20:08:51
(c) 2009 SEGGER Microcontroller GmbH & Co. KG, segger.com Solutions for real time microcontroller applications
Connecting
to J-Link...O.K.
Using SWD as target interface.
Target interface speed: 1000kHz.
STM32F302/303 device identified.
Revision: Y
Reset target...O.K.
Reset option bytes to factory settings...O.K.
Press any key to exit.
=== end snip ===
4) Run “J-Link commander”, enter commands “device stm32f303vc” and “erase”. The tool reports:
WARNING: CPU is running at low speed (8033 kHz)
****** Error: Failed to erase sectors 0 @ address 0x08000000 (erase error)
This is the full output:
=== start snip ===
C:\Users\dmiller>"C:\Program Files (x86)\SEGGER\JLinkARM_V478j\JLink.exe"
SEGGER J-Link Commander V4.78j ('?' for help)
Compiled Nov 22 2013 20:08:49
DLL version V4.78j, compiled Nov 22 2013 20:08:33
Firmware: J-Trace Cortex-M Rev.3 compiled Jun 27 2013 09:39:48
Hardware: V3.10
S/N: 203200451
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Emulator has RAWTRACE capability
VTarget = 3.280V
Info: TotalIRLen = 9, IRPrint = 0x0011
Info: Found Cortex-M4 r0p1, Little endian.
Info: FPUnit: 6 code (BP) slots and 2 literal slots
Info: TPIU fitted.
Info: ETM fitted.
Found 2 JTAG devices, Total IRLen = 9:
#0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
#1 Id: 0x06422041, IRLen: 05, IRPrint: 0x1, STM32 Boundary Scan
Cortex-M4 identified.
Target interface speed: 100 kHz
J-Link>device stm32f303vc
Info: Device "STM32F303VC" selected (256 KB flash, 32 KB RAM).
Reconnecting to target...
Info: TotalIRLen = 9, IRPrint = 0x0011
Info: TotalIRLen = 9, IRPrint = 0x0011
Info: Found Cortex-M4 r0p1, Little endian.
Info: FPUnit: 6 code (BP) slots and 2 literal slots
Info: TPIU fitted.
Info: ETM fitted.
J-Link>erase
Erasing device (STM32F303VC)...
WARNING: CPU is running at low speed (8033 kHz).
****** Error: Failed to erase sectors 0 @ address 0x08000000 (erase error)
Info: J-Link: Flash download: Total time needed: 41.283s (Prepare: 0.685s, Compare: 40.467s, Erase: 0.051s, Program: 0.000s, Verify: 0.000s, Restore: 0.080s)
Erasing done.
J-Link>
=== end snip ===
5) “Download and debug” from IAR with “Use flash loader(s)” checked.
The following error was displayed:
Warning:
There were warnings during download, see Log Window
[img]file:///C:\Users\dmiller\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png[/img]
=== start snip from Log window ===
Tue Jan 07, 2014 12:14:59: Loaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\config\flashloader\ST\FlashSTM32F3xx.mac
Tue Jan 07, 2014 12:15:00: JLINK command: ProjectFile = C:\DennisM\Downloads\stm32f30x_dsp_stdperiph_lib_20140106_1523_cleanish\STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\EWARM\settings\Project_STM32303C-EVAL.jlink, return = 0
Tue Jan 07, 2014 12:15:00: Device "STM32F303VC" selected (256 KB flash, 32 KB RAM).
Tue Jan 07, 2014 12:15:00: DLL version: V4.78j, compiled Nov 22 2013 20:08:33
Tue Jan 07, 2014 12:15:00: Firmware: J-Trace Cortex-M Rev.3 compiled Jun 27 2013 09:39:48
Tue Jan 07, 2014 12:15:00: JTAG speed is initially set to: 32 kHz
Tue Jan 07, 2014 12:15:00: TotalIRLen = 9, IRPrint = 0x0011
Tue Jan 07, 2014 12:15:00: TotalIRLen = 9, IRPrint = 0x0011
Tue Jan 07, 2014 12:15:00: Found Cortex-M4 r0p1, Little endian.
Tue Jan 07, 2014 12:15:00: FPUnit: 6 code (BP) slots and 2 literal slots
Tue Jan 07, 2014 12:15:00: TPIU fitted.
Tue Jan 07, 2014 12:15:00: ETM fitted.
Tue Jan 07, 2014 12:15:01: Hardware reset with strategy 0 was performed
Tue Jan 07, 2014 12:15:01: Initial reset was performed
Tue Jan 07, 2014 12:15:01: Found 2 JTAG devices, Total IRLen = 9:
Tue Jan 07, 2014 12:15:01: #0 Id: 0x4BA00477, IRLen: 4, IRPrint: 0x1 CoreSight JTAG-DP
Tue Jan 07, 2014 12:15:01: #1 Id: 0x06422041, IRLen: 5, IRPrint: 0x1 STM32 Boundary Scan
Tue Jan 07, 2014 12:15:02: -I- execUserFlashInit!
Tue Jan 07, 2014 12:15:02: -I- Hardware watchdog
Tue Jan 07, 2014 12:15:02: 480 bytes downloaded and verified (10.19 Kbytes/sec)
Tue Jan 07, 2014 12:15:02: Loaded debugee: C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\config\flashloader\ST\FlashSTM32F3xxRAM32K.out
Tue Jan 07, 2014 12:15:02: Target reset
Tue Jan 07, 2014 12:15:02: Downloaded C:\DennisM\Downloads\stm32f30x_dsp_stdperiph_lib_20140106_1523_cleanish\STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\EWARM\STM32303C-EVAL\Exe\STM32303C-EVAL.out to flash memory.
Tue Jan 07, 2014 12:15:02: Loaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\config\debugger\ST\Trace_STM32F3xx.dmac
Tue Jan 07, 2014 12:15:02: Hardware reset with strategy 0 was performed
Tue Jan 07, 2014 12:15:02: 18596 bytes downloaded into FLASH and verified (41.56 Kbytes/sec)
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000000, target byte: 0x00, byte in file: 0x50
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000001, target byte: 0x00, byte in file: 0x06
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000003, target byte: 0x00, byte in file: 0x20
=== repeated errors removed ===
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000128, target byte: 0x00, byte in file: 0xF5
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x08000129, target byte: 0x00, byte in file: 0x47
Tue Jan 07, 2014 12:15:02: Warning: Verify error at address 0x0800012B, target byte: 0x00, byte in file: 0x08
Tue Jan 07, 2014 12:15:02: Warning: Too many verify errors, only the first 200 are displayed
Tue Jan 07, 2014 12:15:22: Warning: There were warnings during download, see Log Window
Tue Jan 07, 2014 12:15:22: Loaded debugee: C:\DennisM\Downloads\stm32f30x_dsp_stdperiph_lib_20140106_1523_cleanish\STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\EWARM\STM32303C-EVAL\Exe\STM32303C-EVAL.out
Tue Jan 07, 2014 12:15:22: Hardware reset with strategy 0 was performed
Tue Jan 07, 2014 12:15:22: Target reset
Tue Jan 07, 2014 12:15:23: There was 1 warning during the initialization of the debugging session.
=== end snip ===
6) “Download and debug” from IAR with “Use flash loader(s)” unchecked.
The following error was displayed:
Failed to erase sectors 0 @ address 0x08000000 (erase error). Abort debug session?
[img]file:///C:\Users\dmiller\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png[/img]
I’ve
also seen these errors during other attempts:
Programming failed @ address 0x08012800 (block verification error). Abort debug session?
Warning: Stack pointer is setup to incorrect alignment. Stack addr = 0xAAAAAAAA
[img]file:///C:\Users\dmiller\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png[/img]
[img]file:///C:\Users\dmiller\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png[/img]
End
of excessively detailed report.