Skip to main content
stuart2399
Associate II
March 7, 2008
Question

FLASH programming

  • March 7, 2008
  • 8 replies
  • 1518 views
Posted on March 07, 2008 at 13:47

FLASH programming

    This topic has been closed for replies.

    8 replies

    stuart2399
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:25

    Dear All,

    I am trying to get FLASH programming & erasing working. I have successfully got the ST Flash example program to work.

    I have my own RCC clock setup. When I use that, the flash does not program properly.

    Since I'm not using the ST library, I've turned off the HSI oscillator (since I've got an external crystal).

    If I disable HSI, flash programming doesn't work.

    If I enable HSI, it does!

    I can't seem to find it in the manuals, but I assume the HSI clock is used for programming the flash?

    Is this correct?

    Thanx.

    asterix
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:25

    Hi wobble, STOne-32

    I have also the same pb :( anyone could help us to understand how the flash is clocked when programming ? It seems that the charge pump is using the internal RC (HSI).

    Thanks , Asterix.

    smart
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:25

    where do we enable the HSI oscillator.

    I was looking at the example code under the flash section I could not see where we enable the HSI oscillator.

    In the function void RCC_Configuration(void) I could see how we enable the HSE oscillator not HSI.

    stuart2399
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:25

    Thanks ST-One, I missed that!

    16-32micros
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:25

    Dear asterix, wobble,

    You are right and this information is already mentioned in Flash programming manual PM0042: Page 9/31. It is more clear now ? :)

    Cheers,

    STOne-32

    lanchon
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:25

    @smart.avr,

    haven't seen the example you mention, but I believe the HSI will be enabled unless you specifically turn it off.

    stuart2399
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:25

    Hi smart.avr

    In my code, I'm accessing the RCC Control register directly. The HSI is bit 0. Not using the libraries, but here's my code:

    #define STM32_RCC_CR_HSION 1

    //Turn on the internal oscillator

    RCC->CR = RCC->CR | STM32_RCC_CR_HSION;

    Hope this helps.

    :)

    smart
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:25

    if you download the ARM-based 32-bit MCU STM32F101xx and STM32F103xx firmware library under that you will get the UM0427 Zip file.

    Over there you can find out the 2 example code under the flash section.