Skip to main content
mattfox
Associate III
January 10, 2014
Question

STM32F3 Flash Issues

  • January 10, 2014
  • 2 replies
  • 849 views
Posted on January 10, 2014 at 23:14

I'm working with a STM32F373C8 and I'm trying to program flash while running a program on flash.  This works well whenever I try to program the flash right at the beginning of my program.  However, if I try to send a packet over USART after the initial startup, my program is stalling here:

FLASH_ErasePage(0x0800F800)

Does anyone know a reason why a program would stall here only after running for awhile?  I'm unlocking the flash before, and locking it afterwards.  Thanks for any help you can give to me.

    This topic has been closed for replies.

    2 replies

    chen
    Associate II
    January 13, 2014
    Posted on January 13, 2014 at 12:08

    Hi

    I am not familiar with the STM32F373C8 - so you will have to confirm by reading the data sheet.

    In general, you cannot write and read to the same Flash device while programming it

    ie you program is running in Flash and you are trying to program it!

    2 solutions :

    1 Program in a seperate program (often called a bootloader - not to be confused with the STM bootloader)

    2 Move the SW download code into RAM

    mattfox
    mattfoxAuthor
    Associate III
    January 14, 2014
    Posted on January 14, 2014 at 22:02

    Thanks for the response!  

    I thought that it is okay to program Flash while also running in flash, it just may incur delays.  From several posts on this site as well as in the stm32f3 manual, I've heard that delays could range in the 40-50 ms range, but that would be alright for me.  For my use case, a bootloader wouldn't work, but possibly loading into RAM could.  I'll have to check that out.

    Anybody know why this ErasePage could be stalling for some other reason?