FCCU - Not possible to write to FCCU register, so not possible to configure FCCU faults.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FCCU - Not possible to write to FCCU register, so not possible to configure FCCU faults.

1,219 Views
mikiB
Contributor I

Hello,

Board: DEVKIT-MPC5748G evaluation board Rev D.
MC: MPC5748G

On that MC I am trying to configure FCCU, but without success. I can write to other register, as for example I wrote to SIUL2 register to configure GPIO pin.
When I try to write some data to FCCU registers, value in registers are unchanged.

I check MSR and I am in supervisor mode.
I tried to clear errors but without success, as I can not write NCFK.
When I try to go to configuration state, it is not possible as I cannot write TRANS_KEY, CTRLK and OPR.

CODE:

__asm__("mfmsr %0":"=r"(mfmsrValue));
Log_MSG("MSR ",mfmsrValue); -----> mfmsrValue = 0000 0000 0000 0000 1001 0000 0000 0000 -> so bit 17 is 0 which means supervisor mode.

cleaning fault status, same done for S1 and S2:

FCCU_NCFK = NCFK_KEY;
FCCU_NCF_S0 = 0xFFFFFFFF;

Log_MSG("FCCU_NCFK ", FCCU_NCFK);   value is 0, not changed to key -> 0xAB3498FE
Log_MSG("FCCU_NCF_S0. ", FCCU_NCF_S0); -> value is 0, not changed to -> 0xFFFFFFFF

while(FCCU_STR.CTRL.B.OPS != 0x3); -> exits while loop with ops successful.

......

FCCU_TRANS_LOCK = FEATURE_FCCU_TRANS_UNLOCK;
FCCU_CTRLK = FEATURE_FCCU_UNLOCK_OP1; 
FCCU_STR.CTRL.R |= 0x1; 
Log_MSG("FCCU_TRANS_LOCK ", FCCU_TRANS_LOCK);  --> Trans_lock 0, not changed to 0xBC
Log_MSG("FCCU_CTRLK ", FCCU_CTRLK);  --> CTRLK 0, not changed to unlock value 0x913756AF
Log_MSG("FCCU_STR.CTRL.R ", FCCU_STR.CTRL.R);  --> 0x80 -> OPS is changed from successful to abort
while (FCCU_STR.CTRL.B.OPS != 0x3);  --> stuck in while loop

0 Kudos
Reply
7 Replies

1,179 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

I've wrote and AN on FCCU configuration.

Please follow the guide:

https://www.nxp.com/docs/en/application-note/AN5284.pdf

In case of issues do not hesitate to ask me.

Best regards,

Peter

0 Kudos
Reply

1,165 Views
mikiB
Contributor I

Hello Peter,

I already read AN and wrote my code based on that AN.

Only thing I didn't do is Disable SWT.

Here is my code, can you please check did I miss something:
I will remove logs to avoid additional confusion.

#define FCCU_STR (*(volatile struct FCCU_tag *) 0xFBF58000UL) 
/* FCCU_tag is struct from MPC5748G.h */ 

FCCU_NCFK = NCFK_KEY; 
/*  FCCU_NCFK is FCCU_STR.NCFK.R and NCFK_KEY is 0xAB3498FE */
FCCU_NCF_S0 = 0xFFFFFFFF;
/* FCCU_NCF_S0 is FCCU_STR.NCF_S[0].R */

while(FCCU_STR.CTRL.B.OPS != 0x3);

FCCU_NCFK = NCFK_KEY; 
/*  FCCU_NCFK is FCCU_STR.NCFK.R and NCFK_KEY is 0xAB3498FE */
FCCU_NCF_S1 = 0xFFFFFFFF;
/* FCCU_NCF_S1 is FCCU_STR.NCF_S[1].R */

while(FCCU_STR.CTRL.B.OPS != 0x3);

FCCU_NCFK = NCFK_KEY; 
/*  FCCU_NCFK is FCCU_STR.NCFK.R and NCFK_KEY is 0xAB3498FE */
FCCU_NCF_S2 = 0xFFFFFFFF;
/* FCCU_NCF_S2 is FCCU_STR.NCF_S[2].R */

while(FCCU_STR.CTRL.B.OPS != 0x3);

FCCU_TRANS_LOCK = FEATURE_FCCU_TRANS_UNLOCK;
/* FCCU_TRANS_LOCK is FCCU_STR.TRANS_LOCK.R and FEATURE_FCCU_TRANS_UNLOCK is 0xBC */


/* provide Config state key */
FCCU_CTRLK = FEATURE_FCCU_UNLOCK_OP1; // key for OP1
/*FCCU_CTRLK  is FCCU_STR.CTRLK.R  and FEATURE_FCCU_UNLOCK_OP1 is 0x913756AFU */


/* enter config state - OP1 */
FCCU_STR.CTRL.R |= 0x1; //set OP1 - set up FCCU into the CONFIG mode


/* wait for successful state transition */
while (FCCU_STR.CTRL.B.OPS != 0x3); //operation status successful

0 Kudos
Reply

1,157 Views
mikiB
Contributor I

I just checked SWT_CR register and value in that register is FF00 0102, so WEN (Watchdog Enabled) is 0 which means WDG is disabled.

mikiB_0-1644232890785.png

 

0 Kudos
Reply

1,146 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Not SWT (which is software watchdog). I was talking about internal FCCU watchdog (no interface to user) which is guarding time spend in configuration state.

Once you enter Key ( Control Key (FCCU_CTRLK) you have limited time to configure the FCCU. Usually this is long enough to do complex configurations. But if you debug FCCU during this time (for example step in debug) the timer will expire and it will about configuration state.

You also cant read all FCCU registers via simple read. There is OPR bitfiled in CTRL register which has to be set prior to reading. But all of this I have explained in application note.

 

There is really no other magic in FCCU.

Best regards,

Peter

0 Kudos
Reply

1,185 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

There is really nothing special. Only protection is FCCU,KEY which has to be applied and internal CFG watchdog.

Maybe you are trying to step trough FCCU code in debug mode.

When you enter KEY, internal config watchdog is started and if you step in debug during this time, the watchdog will expire and abort config mode. So do not debug FCCU config functions.

Best regards,

Peter

 

0 Kudos
Reply

1,182 Views
mikiB
Contributor I

Hello Peter,

I am not in debug mode and Log_MSG is used to write to UART.
And from uart log it can be seen that values are not stored to registers.

I didn't insert key to switch to FSM configuration state:
Log_MSG("FCCU_CTRLK ", FCCU_CTRLK);  --> CTRLK 0, not changed to unlock value 0x913756AF

So I don't think it is WDG issue.

Even before CTRLK key, when I am trying to clean errors I cannot write to FCCU registers.
Log_MSG("FCCU_NCFK ", FCCU_NCFK); -> on uart I can see 0, so not changed to 0xAB3498FE

It looks like registers are locked for write.
What is interesting, I also tried to write to Debug field of CTRL register and I can write to debug field.

FCCU_STR.CTRL.B.DEBUG = 1;
Log_MSG("FCCU_STR.CTRL.B.DEBUG After",FCCU_STR.CTRL.B.DEBUG); -> FCCU_STR.CTRL.B.DEBUG is changed to 1.

0 Kudos
Reply

1,144 Views
petervlna
NXP TechSupport
NXP TechSupport

Even before CTRLK key, when I am trying to clean errors I cannot write to FCCU registers.

There is defined procedure you have to follow.

petervlna_0-1644314065334.png

 

0 Kudos
Reply