Hi all,
I have a new project using an STM32L031. I've used MXCube to generate a startup project, and after compiling in Keil and loading the un-modified code to the board, I see that the Program Counter is loaded with an invalid address after reset. Instead of pointing to __main in flash (at "0x080000C0"), it is loaded with "0x1FF0 0220". So the code does not run.
When looking at the flash memory at address 0, the first long word looks correct, pointing to Ram at "0x2000 0CA0", and the Stack Pointer is loaded with that address. But the second long word in flash is actually "0x1FF0 0221".
Looking at the Target options in Keil, the "Read/Only Memory Areas" section looks correct, the on-chip selection is checked -- IROM1: Start: 0x08000000, Size: 0x8000
And the BOOT0 pin is grounded, the flash code is being run, just at the wrong address.
Anyone have ideas? This is a weird one for me.
Thanks!
Forgot to add..
I can see that 0x1FF0xxxx is System Memory (bootloader). Does that provide a clue?
Found the answer.
In the data sheet for the chip I'm using (STM32L031G6), it turns out that for the 28 pin packages, there is one particular version of the chip that has a different pinout than the other packages. Of course I'm using that chip (STM32L031G6U7). The BOOT0 pin is in a different location, and CubeMX doesn't have the correct pinout. I've let ST know...
That was fun :)
Hi Jeff Platt thanks for returning to the community to put your answer here.