Skip to main content
paulsmitton9
Associate III
April 21, 2008
Question

Flash Interrupt

  • April 21, 2008
  • 2 replies
  • 846 views
Posted on April 21, 2008 at 13:53

Flash Interrupt

    This topic has been closed for replies.

    2 replies

    paulsmitton9
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:30

    It seems that one must Unlock the flash before setting the interrupt flag. Thus:

    Code:

    FLASH_Unlock();

    FLASH_ITConfig(FLASH_IT_EOP, ENABLE);

    will interrupt (following a flash operation), but:

    Code:

    FLASH_ITConfig(FLASH_IT_EOP, ENABLE);

    FLASH_Unlock();

    Will not.

    I'm not sure why this is though. I couldn't find any mention in the manuals.

    paulsmitton9
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:30

    I have included the following code in the Flash Example 1 of the STM32 Library, to enable an interrupt after a flash operation:

    Code:

    NVIC_InitStructure.NVIC_IRQChannel = FLASH_IRQChannel;

    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

    NVIC_Init(&NVIC_InitStructure);

    FLASH_ITConfig(FLASH_IT_EOP, ENABLE);

    I have also tried ensureing the HSI is on with:

    RCC_HSICmd(ENABLE);

    This causes an interrupt when debugging (via JTAG), but not when run from flash normally (i.e. after a reset).

    Does anybody know what else I have to do to ensure there is always an interrupt.