STM32F205: Erasing FLASH sector by sector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-17 6:12 AM
I am using STM32F205 and I have designed my own bootloader. Before FLASH programming, my bootloader always erase whole FLASH from sector 1 to sector 11 (it uses fixed count cycle through sectors without determining FLASH size). For devices with 1MB FLASH it is OK, but I wonder what heapens if I use device with 768kB of FLASH and I try to erase sector which does not exist, because of FLASH size. Is this situation indicated through FLASH->SR? I tried it on 512kB device and it seems that it works without indicating of any error. I wonder if this behaviour is aplicable for all devices (with different FLASH sizes) or I have to change erase function implementation and use FLASH size register to examine sectors count.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-17 6:26 AM
All the die have 1MB, you should read the size for your part from the System Loader space.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-17 7:34 AM
unsigned short flashkb = *((unsigned short *)0x1FFF7A22);
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-21 1:40 AM
Thank you for answer. If all the die have 1MB of FLASH, than I don't care about non existing sectors erase and erasing them do not cause errors during erase operation. Am I right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-02-21 2:34 AM
You might get errors for other reasons, but I wouldn't use errors to determine the flash size. If your code needs to adapt to different devices, read the size from it's location, otherwise code your app to only erase the flash it knows about.
Up vote any posts that you find helpful, it shows what's working..
