AnsweredAssumed Answered

STM32F405: Unable to program

Question asked by Sumeet Kler on Jul 17, 2017
Latest reply on Aug 10, 2017 by Willem La Grange

Hi guys, 

I've been working with my STM32F405 for over a month now and all of a sudden my chip is unable to be programmed. When I attempt to program my chip using SW4STM32 I get this following error: 

 

   Open On-Chip Debugger 0.10.0-dev-00275-gd486ac2-dirty (2017-03-06-15:22)
   Licensed under GNU GPL v2
   For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
   Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
   adapter speed: 2000 kHz
   adapter_nsrst_delay: 100
   srst_only separate srst_nogate srst_open_drain connect_assert_srst
   srst_only separate srst_nogate srst_open_drain connect_assert_srst
   Info : Unable to match requested speed 2000 kHz, using 1800 kHz
   Info : Unable to match requested speed 2000 kHz, using 1800 kHz
   Info : clock speed 1800 kHz
   Info : STLINK v2 JTAG v27 API v2 SWIM v6 VID 0x0483 PID 0x3748
   Info : vid/pid are not identical: 0x0483/0x374B 0x0483/0x3748
   Info : using stlink api v2
   Info : Target voltage: 3.247337
   Info : STM32F405VGTx.cpu: hardware has 6 breakpoints, 4 watchpoints
   Info : Unable to match requested speed 2000 kHz, using 1800 kHz
   Info : Unable to match requested speed 2000 kHz, using 1800 kHz
   adapter speed: 1800 kHz
   STM32F405VGTx.cpu: target state: halted
   target halted due to debug-request, current mode: Thread
   xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
   configuring PLL
   ** Programming Started **
   auto erase enabled
   Info : device id = 0x10076413
   Warn : STM32 flash size failed, probe inaccurate - assuming 1024k flash
   Info : flash size = 1024kbytes
   STM32F405VGTx.cpu: target state: halted
   target halted due to breakpoint, current mode: Thread
   xPSR: 0x61000000 pc: 0x20000046 msp: 0xfffffffc
   wrote 49152 bytes from file Debug/G3_Working_Proto.elf in 8.144894s (5.893 KiB/s)
   ** Programming Finished **
   ** Verify Started **
   STM32F405VGTx.cpu: target state: halted
   target halted due to breakpoint, current mode: Thread
   xPSR: 0x61000000 pc: 0x2000002e msp: 0xfffffffc
   Error: checksum mismatch - attempting binary compare
   diff 0 address 0x08000000. Was 0xff instead of 0x00
   diff 1 address 0x08000001. Was 0xff instead of 0x00
   diff 2 address 0x08000002. Was 0xff instead of 0x02
   diff 3 address 0x08000003. Was 0xff instead of 0x20
   diff 4 address 0x08000004. Was 0xff instead of 0xe1
   diff 5 address 0x08000005. Was 0xff instead of 0xa3
   --> this continues until diff 127 where all say it is 0xff instead of...
   More than 128 errors, the rest are not printed.
   ** Verify Failed **
   shutdown command invoked

 

I then attempted to use the ST Visual Programmer and ST-Link utility. In there I can see that my read out protection has been set to level 1 but when I attempt to set the byte to level 0 i get the following error: 

 

   Could not set Option bytes!

   Please reset target and retry.

 

The issue happened to me the other day but after a few minutes I was able to program it again, it then happened again a few hours later and I have not been able to do anything since. I have tried resetting the chip but it has no effect. I do not believe it is the ST-Link as I have tried using two different ones. It seems to me that the flash may have been corrupted/died out, so I have ordered a new chip,  but I can not seem to think of a reason for this to happen as I have been using it for over a month with no issue. Any suggestions/tips for what may have caused this would be great so I can avoid this issue in the future or fixes so I can get this chip up and running again. 

 

Thanks in advance, 

Sumeet

Outcomes