cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474 failed to erase chip.

kerry1
Associate

I use J-Link and STM32G474, which can burn the program, but can't erase the chip. After trying to use J-Link STM to unlock the chip, it also did not work

 

Application log started
 - J-Flash V7.92b (J-Flash compiled Aug 23 2023 14:00:43)
 - JLinkARM.dll V7.92b (DLL compiled Aug 23 2023 14:00:04)
Reading flash device list [C:\Program Files\SEGGER\JLink\ETC/JFlash/Flash.csv] ...
 - List of flash devices read successfully (451 Devices)
Reading MCU device list ...
 - List of MCU devices read successfully (10201 Devices)
Opening project file [C:\Users\PC\AppData\Roaming\SEGGER\Default.jflash] ...
 - Project opened successfully
Opening data file [E:\JOJOTester_HM\Testinfo\291\data\STM32G4xx-Kernel.bin] ...
 - Data file opened successfully (5368 bytes, 1 range, CRC of data = 0x86DE39CB, CRC of file = 0x86DE39CB)
Opening data file [E:\JOJOTester_HM\Testinfo\291\data\STM32G4xx-Kernel.bin] ...
 - Data file opened successfully (5368 bytes, 1 range, CRC of data = 0x86DE39CB, CRC of file = 0x86DE39CB)
Connecting ...
 - Connecting via USB to probe/ programmer device 0
 - Probe/ Programmer firmware: J-Link V12 compiled Aug  2 2023 10:34:27
 - Probe/ Programmer S/N: 602004233
 - Device "STM32G474VE" selected.
 - Target interface speed: 4000 kHz (Fixed)
 - VTarget = 3.309V
 - InitTarget() start
 - JTAG selected. Identifying JTAG Chain...
 - TotalIRLen = 9, IRPrint = 0x0011
 - JTAG chain detection found 2 devices:
 -  #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP
 -  #1 Id: 0x16469041, IRLen: 05, Unknown device
 - JTAG Chain Identified. Connecting to DAP TAP...
 - Successfully connected to selected DAP TAP.
 - DAP initialized successfully.
 - InitTarget() end - Took 12.1ms
 - TotalIRLen = 9, IRPrint = 0x0011
 - JTAG chain detection found 2 devices:
 -  #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP
 -  #1 Id: 0x16469041, IRLen: 05, Unknown device
 - DPv0 detected
 - Scanning AP map to find all available APs
 - AP[1]: Stopped AP scan as end of AP map has been reached
 - AP[0]: AHB-AP (IDR: 0x24770011)
 - Iterating through AP map to find AHB-AP to use
 - AP[0]: Core found
 - AP[0]: AHB-AP ROM base: 0xE00FF000
 - CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
 - Found Cortex-M4 r0p1, Little endian.
 - FPUnit: 6 code (BP) slots and 2 literal slots
 - CoreSight components:
 - ROMTbl[0] @ E00FF000
 - [0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
 - [0][1]: E0001000 CID B105E00D PID 003BB002 DWT
 - [0][2]: E0002000 CID B105E00D PID 002BB003 FPB
 - [0][3]: E0000000 CID B105E00D PID 003BB001 ITM
 - [0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
 - [0][5]: E0041000 CID B105900D PID 000BB925 ETM
 - Executing init sequence ...
  - Initialized successfully
 - Target interface speed: 4000 kHz (Fixed)
 - Found 2 JTAG devices. Core ID: 0x4BA00477 (None)
 - Connected successfully
Auto programming target (5368 bytes, 1 range) ...
 - Checking if selected data fits into selected flash sectors.
 - Start of determining flash info (Bank 0 @ 0x08000000)
 - End of determining flash info
 - Flash bank info:
 - 128 * 2 KB @ 0x08000000
 - 128 * 2 KB @ 0x08040000
 - Start of preparing flash programming
 - End of preparing flash programming
 - Start of determining dirty areas in flash cache
 - End of determining dirty areas
 - CPU is running at 56000 kHz.
 - Start of erasing sectors
 - Blank checking 0x08000000 - 0x080017FF
 - Erasing range 0x08000000 - 0x080017FF (  3 Sectors, 6 KB)
 - End of erasing sectors
 - Start of flash programming
 - Programming range 0x08000000 - 0x080017FF (  3 Sectors, 6 KB)
 - End of flash programming
 - Flash programming performed for 1 range (6144 bytes)
 - 0x8000000 - 0x80017FF (  3 Sectors, 6 KB)
 - Start of verifying flash
 - End of verifying flash
 - Start of restoring
 - End of restoring
 - Executing exit sequence ...
  - De-initialized successfully
 - Target erased, programmed and verified successfully - Completed after 0.189 sec
Opening data file [E:\JOJOTester_HM\Testinfo\291\data\p291-Headcontroller-Bootloader.bin] ...
 - Data file opened successfully (42160 bytes, 1 range, CRC of data = 0xEEF31461, CRC of file = 0xEEF31461)
Auto programming target (42160 bytes, 1 range) ...
 - Checking if selected data fits into selected flash sectors.
 - Start of determining flash info (Bank 0 @ 0x08000000)
 - End of determining flash info
 - Flash bank info:
 - 128 * 2 KB @ 0x08000000
 - 128 * 2 KB @ 0x08040000
 - Start of preparing flash programming
 - End of preparing flash programming
 - Start of determining dirty areas in flash cache
 - End of determining dirty areas
 - CPU speed could not be measured.
 - Start of erasing sectors
 - Blank checking 0x08005000 - 0x0800F7FF
 - Erasing range 0x08005000 - 0x0800F7FF ( 21 Sectors, 42 KB)
 - End of erasing sectors
 - Start of flash programming
 - Programming range 0x08005000 - 0x0800CFFF ( 16 Sectors, 32 KB)
 - Programming range 0x0800D000 - 0x0800F7FF (  5 Sectors, 10 KB)
 - End of flash programming
 - Flash programming performed for 1 range (43008 bytes)
 - 0x8005000 - 0x800F7FF ( 21 Sectors, 42 KB)
 - Start of verifying flash
 - End of verifying flash
 - Start of restoring
 - End of restoring
 - Executing exit sequence ...
  - De-initialized successfully
 - Target erased, programmed and verified successfully - Completed after 1.092 sec
Opening data file [E:\JOJOTester_HM\Testinfo\291\data\P291-HeadControl-FactoryApp.bin] ...
 - Data file opened successfully (154141 bytes, 1 range, CRC of data = 0x563A56AF, CRC of file = 0x563A56AF)
Auto programming target (154141 bytes, 1 range) ...
 - Checking if selected data fits into selected flash sectors.
 - Start of determining flash info (Bank 0 @ 0x08000000)
 - End of determining flash info
 - Flash bank info:
 - 128 * 2 KB @ 0x08000000
 - 128 * 2 KB @ 0x08040000
 - Start of preparing flash programming
 - End of preparing flash programming
 - Start of determining dirty areas in flash cache
 - End of determining dirty areas
 - CPU speed could not be measured.
 - Start of erasing sectors
 - Blank checking 0x08020000 - 0x0803FFFF
 - Erasing range 0x08020000 - 0x0803FFFF ( 64 Sectors, 128 KB)
 - Blank checking 0x08040000 - 0x08045FFF
 - Erasing range 0x08040000 - 0x08045FFF ( 12 Sectors, 24 KB)
 - End of erasing sectors
 - Start of flash programming
 - Programming range 0x08020000 - 0x08027FFF ( 16 Sectors, 32 KB)
 - Programming range 0x08028000 - 0x0802FFFF ( 16 Sectors, 32 KB)
 - Programming range 0x08030000 - 0x08037FFF ( 16 Sectors, 32 KB)
 - Programming range 0x08038000 - 0x0803FFFF ( 16 Sectors, 32 KB)
 - Programming range 0x08040000 - 0x08045FFF ( 12 Sectors, 24 KB)
 - End of flash programming
 - Flash programming performed for 1 range (155648 bytes)
 - 0x8020000 - 0x8045FFF ( 76 Sectors, 152 KB)
 - Start of verifying flash
 - End of verifying flash
 - Start of restoring
 - End of restoring
 - Executing exit sequence ...
  - De-initialized successfully
 - Target erased, programmed and verified successfully - Completed after 3.817 sec
Erasing chip ...
 - 258 sectors, 3 ranges, 0x8000000 - 0x807FFFF, 0x1FFF7800 - 0x1FFF782F, 0x1FFFF800 - 0x1FFFF82F
 - Start of determining flash info (Bank 0 @ 0x08000000)
 - End of determining flash info
 - Flash bank info:
 - 128 * 2 KB @ 0x08000000
 - 128 * 2 KB @ 0x08040000
 - Start of preparing flash programming
 - End of preparing flash programming
 - Start of determining dirty areas in flash cache
 - End of determining dirty areas
 - CPU speed could not be measured.
 - Start of erasing chip
 - ERROR: Failed to erase chip.
Failed to execute RAMCode for chip erase!
 - End of erasing chip
 - ERROR: Erase failed
 - Start of restoring
 - End of restoring
 - ERROR: Failed to erase chip
Disconnecting ...
 - OnDisconnectTarget() start
 - OnDisconnectTarget() end - Took 10us
 - Disconnected

 

 

1 REPLY 1
FBL
ST Employee

Hello @kerry1 

 

If you are using a customized board, it is very likely that the issue is linked to fluctuating/insufficient power or loose connection. If you have nucleo or disco board you can upgrade the ST Link with specific version of J Link firmware.

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.