Hi,
I tested the code and it works as expected on my side:
//unlock mid block 0x00FB_8000 - 0x00FB_FFFF
C55FMC.LOCK0.R &= 0xFFFEFFFF;
//erase the mid block
C55FMC.MCR.B.ERS = 1;
C55FMC.SEL0.R = 0x00010000; //select the mid block
*(unsigned int*)0x00800000 = 0xFFFFFFFF; //interlock write
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.ERS = 0;
//program one page in the mid block
C55FMC.MCR.B.PGM = 1;
*(unsigned int*)0x00800000 = 0x11111111; //interlock write
*(unsigned int*)0x00800004 = 0x22222222; //up to 8 words (one 256bit page) can be programmed at once
*(unsigned int*)0x00800008 = 0x33333333;
*(unsigned int*)0x0080000C = 0x44444444;
*(unsigned int*)0x00800010 = 0x55555555;
*(unsigned int*)0x00800014 = 0x66666666;
*(unsigned int*)0x00800018 = 0x77777777;
*(unsigned int*)0x0080001C = 0x88888888;
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.PGM = 0;
Where does it crash in your project? Which instruction?
Regards,
Lukas