P1 Unlock, Erase, and Reflash... Doesn't boot, what am I missing?

Everything was working well until suddenly it would not take a firmware update via dfu. It gave its normal “flash error” or whatever that everyone says to ignore for now… But it didn’t actually write the changes to memory. So I tried flashing with my j-link. Somehow a block in the user part (0x80A0000 - 0x80C0000) had become write protected. A verify against the bin file i was trying to write conformed there was block that didn’t get re-wrote. Next I tried an erase command, it failed at the write protected memory. The j-link software i have doesn’t natively support unlocking of the STM32F205RG, so I did it manually.

Like this,

(sets unprotect option bits)
wrote 0x08192A3B to address 0x40023C08
wrote 0x4C5D6E7F to address 0x40023C08
(restore non-write protected state)
wrote 0xFFFF to 0x40023C16
(write option bytes)
wrote 0xEF to 0x40023C14
then reset target

After all that, the erase works without errors.

Heres the part thats frustrating me.

According to https://github.com/spark/docs/issues/82

system-part1 starts at address 0x8020000
system-part2 starts at address 0x8060000
user-part starts at address 0x80A0000
ota-backup starts at address 0x80C0000
factory backup starts at 0x80E0000

I wrote system-part1.bin to 0x8020000
i wrote system-part2.bin to 0x8060000
i wrote my user code bin to 0x80A0000, 0x80C0000, and 0x80E0000
reset target, nothing boots, no leds, no power at setup pin. reset is high.

So i repeated above but with files from here https://github.com/spark/firmware/releases/tag/v0.4.4

I wrote system-part1-0.4.4-p1.bin to 0x8020000
i wrote system-part2-0.4.4-p1.bin to 0x8060000
i wrote tinker-0.4.4-p1.bin to 0x80A0000, 0x80C0000, and 0x80E0000
reset target, once again, nothing boots, no leds, no power at setup pin. reset is high.

What am I missing? And why isn’t there a step by step covering this in the P1 datasheet?

If you completely erased your device, it sounds like you are missing the bootloader. You can build this locally

cd bootloader
make PLATFORM=P1 clean all

Then use your jtag programmer to flash the binary produced to location 0x8000000. Then you should be able to see the LED light up and have access to DFU mode, as well as regular firmware startup. :smile:

1 Like