cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2 In application programming using image files

mit
Associate II
Posted on December 08, 2012 at 02:39

Hi All,

Device: STM32F207VC

Flash: 256KB

RAM: 128KB

I have a general question regarding programming image file to user code area in flash located at: 0x8000000

I am running following procedure to do this.

1). Making sure Flash Erase/Read/Write utility functions are executing from SRAM

2). Program the binary image file to Sector 5 on flash, located at addr: 0x8020000 (works fine)

3). Disable interrupts

4). Copy code image file from 0x8020000 to 0x8000000.

Problem occurs when I try to erase sector 0 located at 0x8000000, my program stalls, and but debugger is running so I was able to identify that FLASH_SR value is (status: 0xC0), meaning that PGSERR and PGPERR bits are set. 

Not sure what the problem is. Do I need to relocated RESET vector and vector table to SRAM?

Thanks in advance,

Mit
3 REPLIES 3
Posted on December 08, 2012 at 03:47

It would definitely be advisable to have some free standing vectors that aren't getting erased.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
mit
Associate II
Posted on December 08, 2012 at 05:06

I relocated vector table using SCB->VTOR to SRAM, and the program is still stalled. 

Is there anything else that you suggest?

Posted on December 08, 2012 at 14:58

Have you stepped into the failure point with the debugger?

Have you cleared any pending status before starting?

How are you disabling interrupts?

Are you getting hard faults?

Make sure sector 0 is not write protected.

Try running without a debugger, output progress/telemetry via a serial port.

The flash writes tends to give failure issues if it is not erased, or the writes are not suitably aligned.

The first 16K sector should be able to erase and update, I have used it for a boot loader, and while I typically don't update it, but rather the application in other sectors, I do have a mechanism for updating it. When I do so I don't have to disable interrupts, as none are running.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..