cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer: Error: Flash loader cannot be loaded

EAgui
Associate

Recently, I bought a clone of ST-Link V2.

I am trying to program a RAK5205 board with an STM32L151CB MCU on it, with a basic program for blinking LEDs.

If I use the STM32 ST-Link Utility v 4.5.0.0, open the file RAK5205_Blink.hex and program the MCU, it ends correctly and the program runs without problems on the board. If I want to completely erase the Flash memory, it does it correctly with this indication:

Device ID: 0x429

Device flash Size: 128KBytes

Device family: STM32L100x8xxA / L15xx8xxA

Flash memory erased.

Now, if I open the STM32CubeProgrammer v2.1.0, open the same file RAK5205_Blink.hex, the ST-Link v2 is recognized and connected correctly, read the memory of the MCU without problems, but when I want to program it in the same way than before, it shows the error, "Flash loader can not be loaded".

What is the difference between the ST-Link Utility and the STM32CubeProgrammer regarding device detection and programming? 

What exactly does the error"Flash loader can not be loaded" means?

One difference I noted is that the STM32CubeProgramer, detected the Device as STM32L100x6xxA / STM32L100x8x ... with a Flash Size of 27520 KB instead of 128KB that has the MCU, different from what it is detected with ST-Link Utility.

Sorry if it is an stupid question, I'm a newby trying to lern. I'll appreciate any opinion or suggestion.

My OS is Windows 7 Ultimate.

Thank you

13 REPLIES 13
AHofm
Associate II

… I got the same issue with RAK811

RScho.14
Associate

You must disable the read protection. The easiest way to do this is with the ST tool "Flash Loader Demonstrator". After a few next clicks you will find the option "Disable Read Protection" there. After that, you can check the "Option Bytes" with the STM32 ST-Link Utility. After that debugging ist running like a charm.

LKamm.2
Associate II

We have got the same issue:

  1. We use the STM32L151CBT6-A on a custom PCB. The hardware is properly installed. All supply pins are connected with their respective signals. The programming connections are fine.
  2. The software STM32CubeProgrammer is capable of reading the Flash and Option Bytes, but programming or erasing the flash results in the error message: "Error: Flash loader cannot be loaded". The same error occurs using the internal Debugger / Programmer in STM32CubeIDE.
  3. In contrast, flash programming is possible using the STM32 ST-LINK Utility by loading the .bin file. The programm is executed correctly.

I have no idea, what the source of this error might be. Since flashing and executing the program are both working fine after using the older ST-LINK Utility, the issue should be located inside the Toolchain / STM32CubeProgrammer.

Please respond to this entry if you are facing the same problem or have any ideas to solve the issue.

LKamm.2
Associate II

If anybody else is experiencing the same issue as mentioned in my previous post:

For me it works not to use the STM32 Cube Programmer (GUI / CLI or integrated in Cube IDE).

I have switched to openocd (Windows x64 binaries), either by opening a Debugging server manually or integrating the server start in Cube IDE. This works perfectly fine. My platform:

Windows 10 64 bit

Cube MX / IDE / Programmer

STLINKV2/1

The problem occured with STM32L151CB-A and STM32L152CB-A.

Same problem, it is not working to write with the STM32 Cube Programmer.

Target:

0693W00000590RZQAY.pngIt does work with ST Visual Programmer and STM32 ST-Link Utility.

Windows 8 64 bit

Original ST-LINK/V2

LucHardware
Associate III

I have also the same problem

0693W000007CKH9QAO.png

All the people on the thread have STM32L1 parts, running Windows, so I suspect you actually have a different problem

https://community.st.com/s/question/0D53W00000VivMBSAZ/access-the-flash-memory-from-stm32f767bi

The interaction with the device looks to be broken, so I'd assume some low-level drivers on the ST-LINK side.

Did the new version or the patch offered work?

Is the failure only in Ubuntu? Or did it follow you to Windows too?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LucHardware
Associate III

Hi,

In the Terminal "LSUSB" I find "ID xxxx:xxxx STMicroelectronics ST-LINK/V2". Some pages from the STM32F767BI are readable. I already install the latest linux driver for the ST-LINK/V2 version 1.0.3-1 from the packet en.stsw-linl007_V2-38-27.zip (other versions are windows only).

LucHardware
Associate III

Still no sollution. They mention on google about st-link utility but this is integrated in the STM32 IDE.

Can someone help me out, if I run the IDE it gives the result below:

STMicroelectronics ST-LINK GDB server. Version 5.7.0

Copyright (c) 2020, STMicroelectronics. All rights reserved.

Starting server with the following options:

       Persistent Mode           : Disabled

       Logging Level             : 1

       Listen Port Number        : 61234

       Status Refresh Delay      : 15s

       Verbose Mode              : Disabled

       SWD Debug                 : Enabled

       InitWhile                 : Enabled

Waiting for debugger connection...

Debugger connected

     -------------------------------------------------------------------

                       STM32CubeProgrammer v2.6.0-RC3                 

     -------------------------------------------------------------------

ST-LINK SN : 55FF6D066684564928211687

ST-LINK FW : V2J37S7

Board      : --

Voltage    : 3,26V

SWD freq   : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x451

Revision ID : Rev Z

Device name : STM32F76x/STM32F77x

Flash size : 63 KBytes (default)

Device type : MCU

Device CPU : Cortex-M7

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_lSOXfX.srec

 File         : ST-LINK_GDB_server_lSOXfX.srec

 Size         : 6092 Bytes

 Address      : 0x08000000

Erasing memory corresponding to segment 0:

Erasing external memory sector 0

Error: failed to erase memory

Error: failed to erase memory

Encountered Error when opening /opt/st/stm32cubeide_1.5.0/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.linux64_1.5.0.202011040924/tools/bin/STM32_Programmer_CLI

Error in STM32CubeProgrammer

Debugger connection lost.

Shutting down...