2009-03-12 01:31 AM
2006-09-12 02:27 AM
Hello,
I am trying to implement in-application flash programming using the flash end-of-write interrupt. My interrupt service routine triggers only on the first write. All subsequent writes to flash do not trigger an interrupt, although the interrupt pending bit INTP in the flash control register FLASH_CR0 gets set. Other interrupts keep working as expected. The Flash Programming Reference Manual mentions the end-of-write interrupt only very briefly. A google search on interrupt-driven flash programming for STR7 didn't return anything. What am I doing wrong? Or have I discovered a bug in the silicon? Thanks for any hints, - mike2006-09-12 06:01 AM
Hello,
You have to reset the INTP bit on your interrupt service routine. Rgds, Bouha.2006-09-12 07:02 AM
I do reset the INP bit in the ISR. Besides, if I didn't clear the interrupt pending bit, I would expext the ISR to be reactivated immediately on exit, exactly as it happens with interrupts from other peripherals.
Can anyone confirm that interrupt-driven flash programming works? Can my problems be related to single-stepping through the code in the debugger?2006-09-12 09:05 PM
Hi,
I verify it and it works fine whith the library flash routines. I guess you aren't using the library flash routines? Rgds, Bouha.2006-09-12 09:33 PM
No, I am not using the STR71x standard library. I checked the library source and found that it does not use flash end-of-write interrupt, so the library cannot expose that problem.
I can work around the problem by not using interrupts for flash programming in my application. But it would be much better if flash behaved as advertised, so that I could write a self-contained interrupt-driven driver for flash programming. Still looking for hints, - mike2006-09-13 02:00 AM
It's simple, you have just to add the following code line to enable the interrups from the Flash and use the standard library Flash routines (Write & Erase)
FLASHR->CR0 |= 0x200000; And in the 71x_it.c file add the following line code to clear the Flash interrupt pending bit. FLASHR-> &= ~0x100000; Hope this helps you, Rgds2006-09-13 03:34 AM
Thank you for the suggestion. I know it is simple. I have read the manuals and the library's source code. I am confident that my code is correct since it works if I don't rely on flash end-of-write interrupt and call my interrupt handler from a loop that polls the INTP bit.
My question is: has anyone used flash end-of-write interrupt? Does it actually work? - mike2006-09-13 04:53 AM
After some investigation I noticed the following:
1) My interrupt-driven code works as expected if I don't interrupt it with the debugger. 2) If I comment out the line that clears the INTP bit in my ISR, the program still works as expected. That is, when no flash write operation takes place, the ISR is not called. Conversely, the ISR is called after each flash write operation. All of that indicates that the INTP bit is not a replica of the flash module's interrupt request line, unlike with other peripherals. It is merely an indication that the flash module has generated an interrupt request. Moreover, it appears that the flash module only asserts its interrupt request line for a certain period. If the EIC cannot accept the interrupt during that period (e.g. the corresponding bit in IER0 is not set or the MCU is in the debug state) then the interrupt is lost. If anyone from ST is reading this, could you please convey that information to someone who can put it in the relevant documentation.2006-09-13 05:18 AM
New here, aren't you?