Erik - / FreescaleIAP

Dependents:   18_PT1000 RDA5807M-FM-Radio flashaccess TF_conops_BAEFLAGIMAN ... more

Files at this revision

API Documentation at this revision

Comitter:
Sissors
Date:
Fri Jul 18 20:18:21 2014 +0000
Parent:
3:0f127a8ba79b
Child:
5:a5cfedcf55d6
Commit message:
Disable IRQs during flash commands

Changed in this revision

FreescaleIAP.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/FreescaleIAP.cpp	Fri Jul 18 06:17:00 2014 +0000
+++ b/FreescaleIAP.cpp	Fri Jul 18 20:18:21 2014 +0000
@@ -104,9 +104,11 @@
 /* Clear possible flags which are set, run command, wait until done */
 inline void run_command(void) {
     //Clear possible old errors, start command, wait until done
+    __disable_irq();            //Disable IRQs, preventing IRQ routines from trying to access flash (thanks to https://mbed.org/users/mjr/)
     FTFA->FSTAT = FTFA_FSTAT_FPVIOL_MASK | FTFA_FSTAT_ACCERR_MASK | FTFA_FSTAT_RDCOLERR_MASK;
     FTFA->FSTAT = FTFA_FSTAT_CCIF_MASK;
     while (!(FTFA->FSTAT & FTFA_FSTAT_CCIF_MASK));
+    __enable_irq();
 }