2024-09-13 04:18 AM
I want to clear the FCCU flags on my SPC56 chip. From the test application generated by SPC5Studio, I have the following code:
static void spc_clear_fccu_rgm(void) {
/* FCCU CF errors clearing.*/
/* Clear FCCU CF Status Register0 errors.*/
FCCU.CFK.R = 0x618B7A50UL;
FCCU.CFS[0].R = 0xFFFFFFFFUL;
while (FCCU.CTRL.B.OPS != 3U) {
}
/* Clear FCCU NCF Status Register0 errors.*/
FCCU.NCFK.R = 0xAB3498FEUL;
FCCU.NCFS[0].R = 0xFFFFFFFFUL;
while (FCCU.CTRL.B.OPS != 3U) {
}
/* RGM errors clearing.*/
RGM.FES.R = 0xFFFFU;
RGM.DES.R = 0xFFFFU;
}
However, when I execute this on the chip, it gets stuck on the first while loop, since the OPS field is 0x2 (aborted). The reference manual (RM0032) states that:
The ABORT response occurs in the following cases:
– wrong access (missing or wrong key) to the FCCU_CFS register (clear operation OP11)
– wrong access (missing or wrong key) to the FCCU_NCFS register (clear operation OP12)
– wrong access (missing or wrong key) to the FCCU_CTRL register (OP1, OP2, OP16
operation)
– OP1 (CONFIG command) execution when FCCU state ≠ NORMAL or configuration locked
– OP20–OP30 (RESERVED operations) execution
Which one is the likely cause in my case? I would have expected the auto-generated example code to work without errors. Could there be any other causes that are not mentioned in the manual?