2009-03-26 01:47 AM
Boot loader and I2C
2011-05-17 03:58 AM
Hi.
My task is to make a boot loader that take data from the I2C and save it to the flash and then reboot the chip. Simple… My question is, can I use the internal boot loader or do I have to write my own. As fare as I can see, the internal boot loader can only receive data from the USART. :| If somebody knows about a boot loader to the STM32 that can take data form the I2C, please leave a link. Thanks Søren P.2011-05-17 03:58 AM
Hi spa1,
You have just to write your own IAP program using the first page(s) of the flash and you will get your I2C bootloader. Cheers, STone-32.2011-05-17 03:58 AM
HI.
If you run from RAM and do a mass erase and then lose power for some reason before you've had a chance to program the flash you will have lost your bootloader. That’s why I would protect some pages in the flash (for the boot loader) so that the boot loader remain in the flash after a mass erase. Cheers Søren2011-05-17 03:58 AM
Ok Thanks...
I have 2 questions regarding Flash programming according to PM0042 it seems that’s only possible to write one half-word before testing the FLASH_SR_BSY flag, is this correct? My plan is to copy my boot loader from flash to Ram, and then execute it from Ram(to speed it up), then perform a mass erase, and start to program the flash again. But can I protect some pages in the flash (for the boot loader) so that the boot loader remain in the flash after a mass erase? Thanks Søren2011-05-17 03:58 AM
Hi,
My two cents worth: If you run from RAM and do a mass erase and then lose power for some reason before you've had a chance to program the flash you will have lost your bootloader. Unless speed is a huge issue it will be much easier to just run from a few pages of flash and rather than doing a mass erase just erase the pages you need to fit your app into (and never erase the bootloader pages of course). The ST IAP example illustrates this although it uses UART and YMODEM instead of I2C but approach is the same. Cheers Trevor2011-05-17 03:58 AM
I'm pretty sure a mass erase will always erase all pages.
2011-05-17 03:58 AM
Hi.
I can see that in all the examples provided by ST they use the FLASH_ErasePage(). But how can they be sure that the function “FLASH_ErasePage()� not is located in the page that they are erasing? Best regards Søren2011-05-17 03:58 AM
Quote:
But how can they be sure that the function “FLASH_ErasePage()� not is located in the page that they are erasing?
Quite possibly they can't - it is up to the developer (ie, you) to ensure that...2011-05-17 03:58 AM
But how can ST make they examples works, is it luck?? They just use they own library, and they don’t define were to place the erase function in flash.
Best regards