2
\$\begingroup\$

I am trying to program a STM32L152R8 MCU with stm32cubeIDE v1.4. The MCU is not brand-new and is soldered on a board. I want to change its firmware.

While debugging with ST-Link Debugger I encounter the following error:

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_a07132.srec

 File         : ST-LINK_GDB_server_a07132.srec

 Size         : 9052 Bytes

 Address      : 0x08000000
   
Erasing memory corresponding to segment 0:

Error: Flash loader cannot be loaded
    
Error: failed to erase memory

Encountered Error when opening E:\ST\STM32CubeIDE_1.3.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_1.3.0.202002181050\tools\bin\STM32_Programmer_CLI.exe

Error in STM32CubeProgrammer

Debugger connection lost.

Shutting down...

Notes:

  1. The reset pin is connected,
  2. I've tried to mass erase the chip using st-link utility,
  3. OpenOCD works but the live expression is disabled,
  4. Keil uVision and ST-Link Utility work fine without any problems

Any ideas?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Solder a new CPU to the board \$\endgroup\$
    – Voltage Spike
    Commented Aug 24, 2020 at 20:10

2 Answers 2

1
\$\begingroup\$

If your chip is respoinsive and you can access it using ST-Link utility or uVision the problem is that flash memory protection is enabled and attemp to erase, write (ans maybe also read) flash by debugger fails as expected. Probably in utility you also do not see code (instruction bytes) but you see only memory full of zeros or full of ones.

In ST-Link utility select in menu Target > Option bytes and select Read out Protection to Level 0 and in the bottom pane select Unselect all to disable read and write protection of all sectors of flash. Then confirm by Apply button.

Read/Write protection in ST-Link utility

\$\endgroup\$
4
  • \$\begingroup\$ I tried this but the problem is still here. \$\endgroup\$
    – Iman H
    Commented Aug 20, 2020 at 6:19
  • \$\begingroup\$ Could you post screenshot of your config bytes and do you see any byte that is different than 0x00 and 0xFF using ST-Link utility in memory of chip? What is source of your chip? \$\endgroup\$
    – Misaz
    Commented Aug 20, 2020 at 7:33
  • \$\begingroup\$ Misaz All flash memory bytes are 0x00. It is very strange. \$\endgroup\$
    – Iman H
    Commented Aug 25, 2020 at 4:53
  • \$\begingroup\$ @ImanH Could you pust screenshot of your config bytes configuration? Upload it to imgur.com and post link as comment there. I am not sure if they are some differences between F4 (my screenshot) and L1 (your chip) series. When you upload program to your controller using working way, does it works properly? \$\endgroup\$
    – Misaz
    Commented Aug 25, 2020 at 6:40
0
\$\begingroup\$

Probably a software issue. Reinstall your Cube or use another flash utility.

I think so because of these log lines. Probably your installation is corrupted or the device is not supported, etc.

Encountered Error when opening E:\ST\STM32CubeIDE_1.3.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_1.3.0.202002181050\tools\bin\STM32_Programmer_CLI.exe

Error in STM32CubeProgrammer
```
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.