cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f427 flash dual bank in application programming

abasovag
Associate II
Posted on August 24, 2014 at 11:47

Hi!

I work with STM32F427 with 2 Mb flash size and want use high flash bank to load firmware image when upgrading.When I allocate firmware image in low bank (512kb) all works properly, but when i assign address to image to high bank (1024 kb)- i see hard fault error at random points and time- such effects is as stack corrupts. Soft is identical- only image allocation address differ. I know, that when i programm flash in same bank, when code execute- cpu stall, and no interrupts occures, but when code execution is in bank1 and we programm flash in bank 2- code will be executed, so will be interrupts services, including RTOS context switshing etc. Is any limitation of interrupts or some commands execution, while flash programming executed in opposit bank?

#stm32f427-flash-dual-bank
9 REPLIES 9
Posted on August 24, 2014 at 14:35

Hard Faults occur for a number of reasons, if you had an effective handler and debugging strategy you could probably determine exactly why.

You need to make sure that SCB->VTOR, the Vector Table, is correctly configured for the alternate address, this is usually done in SystemInit() in system_stm32f4xx.c

Also if you are swapping the high/low regions of flash then the address will not actually be different. If you aren't swapping regions, then you do risk bricking the device.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
abasovag
Associate II
Posted on August 24, 2014 at 16:52

Posted on August 24, 2014 at 18:42

1 I dont change any settings of SCB->VTOR because upper bank i use only for load new firmware image, that later will be written to low bank. Hard Faults occur at load image process, i.e. at original firmware, and only if load address -is in upper flash bank and low bank - all application tasks and interrupts work. So i see incompatibility of application work (RTOS, IT, etc) with flash program process.Application firmware is same, and Hard Faults occur at random points (most frequently in RTOS core). I think it is concerned with some CPU commands , witch RTOS use or DMA process.

 

2 I don't understand about ''swapping the high/low regions''- it will be very useful to change regions- i.e. start from bank1 or bank2? but i not find in datasheet how realize that.

 

An RTOS is likely to preclude the use of certain instructions. I'd probably look at memory usage, and exactly how/what you're writing.

Reference Manual (RM0090) - SYSCFG_MEMRMP

0690X0000060MmdQAE.gif

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
abasovag
Associate II
Posted on August 24, 2014 at 20:58

Posted on August 24, 2014 at 23:17

SYSCFG_MEMRMP and bit FB_MODE is not nonvolatile, so system will allways start from bank1, and later we may set FB_MODE to remap flash- is it so?

Please top post responses so they are visible.

There is the BFB2 bit in the option bits, pretty sure the Note is wrong, as the second MB is at 0x08100000 not 0x08080000 as it is on 1MB 512+512KB type devices. I would generally still opt for a boot loader in the first 16KB, and have that do the mapping. I think you'd need to check what the BOOTx pins do, and how the System Loader execute/map memory in the second bank.

0690X0000060MmeQAE.gif

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
abasovag
Associate II
Posted on August 25, 2014 at 10:13

martinchloupek9
Associate II
Posted on December 04, 2015 at 13:48

Hi,

I am experiencing the same issue on STM32F427 1MB with dual bank mode enabled. Did you have any luck solving the problem?

Posted on December 04, 2015 at 14:11

Ok, the OP has a total of 4 posts, all in this thread, from over a year ago. Can we please not play me-too, the forum by default isn't going to ping respondents.

Sounds like you have a different part. Perhaps you can clearly, and completely, state your case, including what exactly the problem is and what you have tried, the results, and the mapping registers described in this thread.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
abasovag
Associate II
Posted on September 03, 2016 at 10:16

Problem was resolved only by disabling all interrupts and DMA transfers(waiting its complete) at flash programming time. It is not satisfy the request of  full-time work in

download firmware image proccess. So i had use external SPI flash to load firmware image.