Skip to content

STM32L011G4 flash error (unknown coreid, write_half_pages failed) #564

@zakqwy

Description

@zakqwy
  • Programmer/board type: Stlink/v2-onboard (STM32F030 Discovery Board)
  • Operating system: Linux Mint 17.2
  • stlink version: v1.3.1/git-6f24bde
  • stlink commandline tool name: st-flash
  • Target chip: STM32L011G4

I am attempting to flash a simple 'hello-world' type LED blink program onto a bodged together STM32L011G4-based board, using my STM32F030 Discovery Board's on-board Stlink/v2.

Command: $ make helloworld.stlink-flash

Output:

FLASH helloworld.bin
st-flash 1.3.1
2017-03-02T16:27:46 INFO src/common.c: Loading device parameters....
2017-03-02T16:27:46 INFO src/common.c: Device connected is: L011 device, id 0x10086457
2017-03-02T16:27:46 INFO src/common.c: SRAM size: 0x800 bytes (2 KiB), Flash: 0x4000 bytes (16 KiB) in pages of 128 bytes
2017-03-02T16:27:46 INFO src/common.c: Attempting to write 480 (0x1e0) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000180 erased
2017-03-02T16:27:46 INFO src/common.c: Finished erasing 4 pages of 128 (0x80) bytes
2017-03-02T16:27:46 INFO src/common.c: Starting Half page flash write for STM32L core id
2017-03-02T16:27:46 ERROR src/flash_loader.c: unknown coreid, not sure what flash loader to use, aborting! coreid: bc11477, chipid: 457
2017-03-02T16:27:46 WARN src/flash_loader.c: Failed to write flash loader to sram!
2017-03-02T16:27:46 WARN src/common.c: stlink_flash_loader_init() == -1
2017-03-02T16:27:46 WARN src/common.c:
write_half_pages failed == -1
2/ 3 pages written
2017-03-02T16:27:46 INFO src/common.c: Starting verification of write complete
2017-03-02T16:27:46 ERROR src/common.c: Verification of flash failed at offset: 0
stlink_fwrite_flash() == -1
make: *** [helloworld.stlink-flash] Error 255

I got the same error using st-util and uploading the file manually. One thing I did notice -- when I first attempted to flash the chip the SRAM size was set to 0x4000 (i.e. 16 KiB); this was incorrect for the STM32L0 I am using so I changed line 455 of chipid.c to .sram_size = 0x800, and rebuilt the program. The flash memory size is correct for the G4 version.

I tried running st-flash erase and it seemed to work fine -- all 128 pages erased. I also tried shorting the BOOT0 pin (pin 1) to VCC and resetting the chip a few times, as suggested by other users experiencing similar-looking problems. This didn't seem to have any effect on subsequent programming attempts.

Perusing common.c I did notice the following lines (ln 1835-1836):
else if (sl->flash_type == STLINK_FLASH_TYPE_L0) {
/* use fast word write. todo: half page. */

Does this mean that the half page write mode isn't implemented and I just need to switch over to programming by word? I looked around for an option to do this but I couldn't find one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions