AnsweredAssumed Answered

Problem with internal flash EOP interrupt

Question asked by Gornstar on Jan 17, 2013
Latest reply on Jan 17, 2013 by Gornstar
Hi,
I'm working on a project on the STM32F100 using the CodeSourcery GCC C compiler and linker in eclipse. I'm using some of the standard library from st. The project is almost done and using many timer, interrupts, dma but now i'm stuck on something.

I'm trying to add a module to save a big struct in flash page 127 using interrupt. I can erase the page and write to it, no problem. My problem is that I can't to get the interrupt on the internal flash EOP to trigger. Using the debugger i see that the EOPIE bit is set in FLASH->CR. Right after the erase command the EOP flag rises in the FLASH->SR register but no interrupt triggers. Anybody has an idea?

Here is the code:
void FlashInit(void) {
     FLASH_Unlock();

     FLASH_ClearFlag(FLASH_FLAG_EOP);
     FLASH_ITConfig(FLASH_IT_EOP, ENABLE);

     FLASH_ErasePage(0x0801FC00);     // PAGE 127

     FLASH_ProgramWord(0x0801FC00, 0x12345678);
     FLASH_ProgramWord(0x0801FC02, 0xCAFEFADE);
}

void FLASH_IRQHandler(void) {
     if(FLASH_GetFlagStatus(FLASH_FLAG_EOP) == SET) {
          FLASH_ClearFlag(FLASH_FLAG_EOP);
     }
}

Thanks for any help.

Outcomes