2008-04-21 04:53 AM
Flash Interrupt
2011-05-17 03:30 AM
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.2011-05-17 03:30 AM
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.