cancel
Showing results for 
Search instead for 
Did you mean: 

FCCU configuration

stefanodimascio9
Associate II
Posted on November 14, 2015 at 15:56

Hello everybody, 

I'm using the SPC56EL70L5.Trying to configure the FCCU, I coded:

&sharpdefine CTRLK_OP1 0x913756AF   

&sharpdefine CTRLK_OP2 0x825A132B     //keys needed for operation

&sharpdefine CTRL_OPR1 1    

&sharpdefine CTRL_OPS3 3   

uint32_t FCCU_CONFIG_STATE(void){

    /* ----------------- CONFIG State --------------------- */

    FCCU.CTRLK.R = CTRLK_OP1; /* Key for the operation OP1 */

    FCCU.CTRL.R = CTRL_OPR1;  /* Set the FCCU into the CONFIG state [OP1] */

    while(FCCU.CTRL.B.OPS != CTRL_OPS3);   /* wait for the completion of the operation */

    return 1;

}

But condition is never verified: FCCU.CTRL.OPS is 0x02 (that means operation is aborted) and MCU hangs in the while.

Where is the mistake?

Thanks in advance for the help.

#leopard #fccu #spc56
25 REPLIES 25
stefanodimascio9
Associate II
Posted on February 09, 2016 at 11:45

Before the exception, in sdStart(), ME_PCTL48 (LINFLEX0) is anyway set to 0x11. 

But 

linflexp->LINCR1.R  = 1;                      /* INIT bit.                */

0x00001FCE:   48 10        SE_LI     R0,0x1

0x00001FD0:   B1 0F        SE_STH    R0,0x2(R31)

still causes the exception after the reset.

Erwan YVIN
ST Employee
Posted on February 09, 2016 at 17:07

Hello Stefano ,

LINFLEX0 (PCTL) is not enabled by default in SAFE/DRUN mode.

it is the reason why there is abort.

you should create a function to go in RUN0 mode just before initializing some IPs.

  Best regards

               Erwan

stefanodimascio9
Associate II
Posted on February 09, 2016 at 18:24

I don't understand. The device enters RUN0 with hal_lld_init() in both cases.

stefanodimascio9
Associate II
Posted on February 10, 2016 at 11:05

The only difference I've found is that in sdStart()

  ME.PCTL[n].R = pctl;

0x00001B68:   70 18 E3 FD  E_LIS     R0,0xC3FD

0x00001B6C:   18 06 D1 C0  E_ORI     R6,R0,0xC000

0x00001B70:   C7 01        SE_LWZ    R0,0x1C(R1)

0x00001B72:   74 07 06 3F  E_RLWINM  R7,R0,0x0,0x18,0x1F

0x00001B76:   C6 01        SE_LWZ    R0,0x18(R1)

0x00001B78:   04 60        SE_ADD    R0,R6

0x00001B7A:   18 00 80 C0  E_ADDI    R0,R0,0xC0

0x00001B7E:   01 06        SE_MR     R6,R0

0x00001B80:   90 76        SE_STB    R7,0x0(R6)

in the first case sets 0x11 in ME_PCTL48 and then the debugger shows the content of LINFLEX0, while in the second case 0x11 is asserted and the debugger still shows unknown content, as if LINFLEX is not clocked anyway or something. I think I'm not configuring in the right way some other register i need to, but I can't find which ones. 

Erwan YVIN
ST Employee
Posted on February 10, 2016 at 11:28

Hello Stefano ,

i was not clear.

i have reproduced your issue.. the clock was not initialized in SAFE mode.

In fact, SPC5-HAL is not designed to work in SAFE Mode after Critical Fault.

1) Please Remove

for
the Pre-Clock Initialization Code
if
(ME.GS.B.S_CURRENT_MODE != 2) {
Post-Clock Initialization Code :
{

2) Add this following code in hal_lld.c, main.c (it is just for test)

(cf attachment)

it is working in my side..

you have to force the transition SAFE ==> DRUN ==> RUN0

Best regards

Erwan

________________

Attachments :

hal_lld.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0JC&d=%2Fa%2F0X0000000ba6%2FtfRwcDJRNUSmrPEmtHomRpAembLSXP3K1TGbqqu4V6s&asPdf=false

main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0Tu&d=%2Fa%2F0X0000000ba7%2FgNPMc0AdllYARMyC0vhNoVOSr3gZv1ps4kH2mIM5Djk&asPdf=false
stefanodimascio9
Associate II
Posted on February 26, 2016 at 09:39

Yes, now it works perfectly.

Thank you very much.