[quote user="Agustin Villavedra"]Moving the interrupt vector to RAM should do it, but is it possible/safe to enable interrupts during flash operations?[/quote]As a learning exercise created a test program for a MSP430F6659 with the intent of: Using a timer ISR in RAM, with the ISR vectors also in RAM, to increment a counter every 500 microseconds. Performing an erase, program and verification of flash with the code running in RAM. Due to the documentation saying "Interrupts are automatically disabled during any flash operation" the expected result was that comparing the count of how many times the timer ISR was handled .vs. the elapsed time of the flash operation would show that the timer ISR was not occurring as often as expected. However, the actual result was that the program crashed, with the program counter ending up with the invalid value of 0x4. The crash is occurring during the programming of flash, and from run-to-run the how far though the flash programming before the crash occurs varies. i.e. appears timing sensitive. If the program is changed to place all of the program in flash, rather than RAM, then the program completes and the timer ISR is only executed for approx 42% of the expected iterations. i.e. shows interrupts are being blocked during flash operations. Not sure if the crashes occur due to an error in the program, or the act of attempting to service interrupts from RAM during flash operations has highlighted undefined behavior / an errata. The test program is attached. The value of the predefined symbol USE_RAMFUNCS on the compiler and linker specifies if the timer ISR and flash programming code are in RAM (USE_RAMFUNCS=1) or flash (USE_RAMFUNCS=0). Must admit that is not fully commented. (Please visit the site to view this file)
↧