Thursday, March 10, 2011

stm32vld

Updated project at

https://github.com/dwelch67/stm32vld/wiki/stm32vld

Learned a few things that are not necessarily in the code. When erasing a page the FLASH_AR register is the address of the page not the page number. For example to erase page four put 0x1000 in this register. Second the flash programming doc mentions writing a single halfword to flash then waiting for the busy bit. So far I have been able to write a whole flash page before waiting on the busy bit. Well not a whole page as the sample program is not that big but the whole program.

If you mess up the flash, for example doing something like an ARM based address (lsbit of zero) for the reset vector. The usb/stlink interface will let you get at the registers in the chip, you can blink the leds for example, but I was not able to load programs and run them. Basically was not able to change the program counter (r15) to a thumb based address, allowing it to return execution to sram, the bad boot from flash put it in a bad state. By removing the BOOT0 jumper/strap on the back of the board, the processor will boot using the factory bootloader. Then either using the stlink interface or using a uart based programmer to talk to the bootloader you can then repair the flash with something usable. The board is not bricked. Then if you desire add a solder blob back on there to boot from flash again. It would have been nice if they had a two pin jumper instead of a no-ohm resistor (or solder bridge).

Once I find out how to perform 16 bit writes using the stlink interface then programming the flash can happen directly and not require this two step of loading a program and having the program write the flash.

No comments:

Post a Comment