Hi,
I am trying to write a robust code for S32K142 flash driver. I tried to make erroneous situations to examine the system response and encountered some problems:
Thanks for your attention. I’m looking forward to your reply.
Hello @A_Jabb,
1.
Can you show the content of the FCCOB registers of the command that causes the issue?
2.
How do you write the FSTAT register to clear CCIF.
Read-modify-write operation on FSTAT with ACCERR set will clear that bit.
3.
Please follow the S32K1xx Safety Manual, Section 5.4.1.2 Runtime checks (rev.7.1)
Regards,
Daniel
1. Any unused command code with FCCOB0[bit6] == 1 (E.g. FCCOB0 = 0xFF) causes the issue (execute FCCOB0 = 0xBF does not cause core lock-up and only sets the ACCERR).
or valid commands like Program Phrase that try to write in an unaligned address of P-Flash (Program Phrase that try to write in an unaligned address of D-Flash does not cause core lock-up and only sets the ACCERR).
2. FTFx_FSTAT |= FTFx_FSTAT_CCIF_MASK;
note: (FTFx_FSTAT_CCIF_MASK = 0x80)
It works like you said but the RM (Rev. 14) section 36.4.4.1.2.4 statement is different.
Also RM section 36.5.9.1.2 is like what you said.
thanks
Hi @A_Jabb,
I have just tested launching FTFC->FCCOB[3] = 0xFF and ACCERR is set by this command. Also, Program Phrase (FTFC->FCCOB[3] = 0x07) with an unligned address (0x30004) does set the ACCERR flag.
Can you please share the content of all the FCCOB registers?
Anyway, exceptions are escallated to core lockup if there is no exception handler.
Do you have void HardFault_Handler(void){} in the project?
BR, Daniel
Hi,
I checked with different FCCOB content and it didn't matter. you can try with all other FCCOBs to be 0.
I have a simple Hardfault handler that works fine with other faults.
The thing is that with everything the same but FTFC->FCCOB[3] = 0xFF or 0xBF the system reacts differently.
Anyway, I have to move on from the subject. Thanks for your help ♥.
Hello @A_Jabb,
I really can't reproduce it.
With command 0xFF and with all the rest of FCCOBx = 0x00, I just see ACCERR = 1.
Can you share the project?
BR, Daniel