Problem with STM32CubeProgrammer - Page 1
Forum section: electronics / general

author: IanJ
author_rank: Unknown
timestamp: December 17, 2019, 11:29:38 am
content: Hi all,New to STM32.I modified one of my products from the ATMEL1284 to the STM32F103 and using the Arduino IDE it works great.Now, due to the lack of support for the STM32L151/152 in the Arduino boards library I thought I'd give the ST-Link Utility and the STM32CubeProgrammer a go.I can upload my hex file to the L151 using the ST-Link utility no problem (it appears), but with the STM32CubeProgrammer I can connect, I can read the contents out but I get an error when I tried to upload my hex file."Error: Flash loader cannot be loaded"Also, I get an error when I try to erase sectors of the 151.I am not using any external loaders.I have tried my STLINKV3 as well as my STLINKV2 and get the same problem.I have checked that nothing is write protected in settings and everything is as per default.My ultimate aim is to find a workflow that I can write my C++ prog using the Arduino IDE and all my libraries, and use it on the L151/L152. I do NOT want to start from scratch and dump all my Arduino libraries etc.Ideally, there would be a board in the Arduino IDE for the L151/L152 much the same as there is for the F103 etc.I'm more a hardware engineer than a software guy!Ideas to help an STM32 newbie along?Ian.

author: thm_w
author_rank: Super Contributor
timestamp: December 17, 2019, 10:32:28 pm
content: Is there any need to use the CubeProgrammer if stlink utility is working?Not exactly your question, but I would consider another IDE than the Arduino IDE which has direct support for programming and hopefully debugging: visual studio code, visualgdb, visualmicro, etc.

author: IanJ
author_rank: Unknown
timestamp: December 18, 2019, 08:38:14 am
content: Quote from: thm_w on December 17, 2019, 10:32:28 pmHi,Visualgdb I tested out a couple weeks ago but it has a problem using one of the STM32 Arduino board libraries which it simply imports. I reported to them but they just say it's not their problem even though it works perfect under the Arduino IDE.I just wondered why I cant program with the cube programmer.Ps. I am trying eclipse now, but I think they all use the same method of importing the same boards from the same sources.I have created my own before, I.e. atmega1284 but that was relatively easy compared to STM32.Ian.

author: lordium
author_rank: Regular Contributor
timestamp: December 18, 2019, 09:57:48 am
content: Looking at your picture it does seems to detect your flash size wrong (so maybe also the other settings)... Can you try to read the options bytes and see if that works?from datasheet you should have 32+32 in 2 banks for the option bytes but looks like you try to read 88?0x1FF80000 to 0x1FF8001F0x1FF80080 to 0x1FF8009FEDIT: because I was curious I checked a little more. Seems your device has ID 0x429, but according to their database it should be 0x437 (assuming you have an 151RE). Either the device is wrong or their database. Maybe you can try to swap the ID in the database to trick the program (until ST fix the problem, if it is a problem).C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\Data_Base\STM32_Prog_DB.xml

author: IanJ
author_rank: Unknown
timestamp: December 18, 2019, 07:45:20 pm
content: Thanks for the info........hmmm, probably my fault. Looks like I compiled for one device whilst trying to upload to another. Not to mention I am having Java problems, Eclipse is conflicting with teh Cube programmer and when I fix one it breaks the other.More work on my part required.Ian.