MPC5744P watchdog

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

MPC5744P watchdog

Jump to solution
6,119 Views
cthhk
NXP Employee
NXP Employee

Dear Team:

 

Could you help to provide an example of 5744P watchdog function? I have tried for days but never create the reset...

Both Greenhills and S32DS are fine.

 

Appreciate your support!

 

Best Regards,

Wang.

Labels (1)
1 Solution
3,952 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

I have uploaded 2 examples how to trigger reset with SWT on MPC5744P.

Have in mind that on MPC5744P SWT is not directly wired to RGM (reset generation module) as it was on MPC56xx devices.

SWT is wired to FCCU module which is connected to RGM. In FCCU there is default reaction on SWT timeout no reaction.

Follow my examples to see how to configured correctly FCCU in order to get reset from SWT.

Examples:

Example MPC5744P SWT Short reset GHS614 

https://community.nxp.com/docs/DOC-332498 

Peter

View solution in original post

13 Replies
3,953 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

I have uploaded 2 examples how to trigger reset with SWT on MPC5744P.

Have in mind that on MPC5744P SWT is not directly wired to RGM (reset generation module) as it was on MPC56xx devices.

SWT is wired to FCCU module which is connected to RGM. In FCCU there is default reaction on SWT timeout no reaction.

Follow my examples to see how to configured correctly FCCU in order to get reset from SWT.

Examples:

Example MPC5744P SWT Short reset GHS614 

https://community.nxp.com/docs/DOC-332498 

Peter

3,952 Views
lmonologue
Contributor I

Hi,Peter 

   

I used your example,It always stay in this line of code from function FCCU_Init():

while (FCCU.CTRL.B.OPS != 0x3)

It can't enter config mode. I use Trace32 and lauterbach.

Thank you!

Li Jun

0 Kudos
3,952 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

1. Do not step in debugger while in FCCU config mode. It has internal watchdog which will abort mode change operation and you will never get into any mode than normal.

2. Make sure your faults are all cleared before entering FCCU config mode.

For more details read FCCU chapter in reference manual or my application notes dealing with how to configure FCCU which are on our web site.

Peter

0 Kudos
3,952 Views
xiaobozheng
Contributor III

飞思卡尔有几版CPU 本身就有问题,上电自检就会出错,直接导致FCCU进入Fault 模式, 所以你根本配置不了。

0 Kudos
3,952 Views
lmonologue
Contributor I

你知道5744P这款是这样吗?因为我看很多人的帖子都是这个问题,调用clear faults()也无法清掉。

0 Kudos
3,952 Views
xiaobozheng
Contributor III

  MPC5744P 这款MCU ,的前几个型号是有问题的, 飞思卡尔不厚道,一直在市场上卖不回收,无法做安全功能。 我不知道你用的是那一版MPC5744P。  但你最好查一下你那一版的勘误表。  如果对应的FCCU 错误过多。还是换最新的MCU吧。 还有就是给你一个招,把MCU的startup -self test 给禁止掉。 就会少报很多错到FCCU。 而且上电自检的不一定稳定,还覆盖率低。

0 Kudos
3,952 Views
lmonologue
Contributor I

Hi Peter,

I don't step in debugger according to your answer,and I called the function  FCCU_clear_faults() at the start of main function,but it return 1 of ret_val that shows it can't cleared  all FCCU errors. So it still  can't enter config state. I don't know the reason or there are other errors in my codes?The following codes are three functions of FCCU.

void FCCU_Init(void)
{
/*switch FCCU into CONFIG mode*/
  /*1. unlock CONFIG state*/
  FCCU.TRANS_LOCK.R = 0xBC;
  /*2. Key for OP1 */
  FCCU.CTRLK.R = 0x913756AF;
  /*3. OP1: Set FCCU to CONFIG mode*/
  FCCU.CTRL.R = 1;
  /*4. wait untill switching to CONFIG mode*/
  while(FCCU.CTRL.B.OPS != 3);
   
  /* enable reaction for fault 14(SWT) */
   FCCU.NCFS_CFG.B.NCFSC14 = 0x1;      //short reset
      
/*switch FCCU back to NORMAL mode*/
  /*1. Key for OP2*/
  FCCU.CTRLK.R = 0x825A132B;
  /*2. OP2: Set FCCU to NORMAL mode*/
  FCCU.CTRL.R = 2;
  /*3. wait untill switching to NORMAL mode*/
  while(FCCU.CTRL.B.OPS != 3);
}
 
void Read_FCCU_NCF_S(uint32_t *pu32FccuNcfStatus)
{
 /*1. Read the NCF status register (see the FCCU_NCF_S register)*/
  FCCU.CTRL.R = 0xA;
  /*2. wait untill switching to CONFIG mode*/
  while(FCCU.CTRL.B.OPS != 3);
  /*3. read the Status*/  
  *pu32FccuNcfStatus++ = FCCU.NCF_S[0].R;
  *pu32FccuNcfStatus++ = FCCU.NCF_S[1].R;
  *pu32FccuNcfStatus++ = FCCU.NCF_S[2].R;
}
 
 
/**********************************************************************************************
* This function clear all FCCU_NCF_S0/1/2 bits by writing key to FCCU.NCFK.R register.
* And will store the updated FCCU_NCF_S0/1/2 bits into the parameter pu32Status
Return 0 if all FCCU errors were cleared; otherwise return 1;
**********************************************************************************************/
uint32_t FCCU_clear_faults(void)
{
       uint32_t u32TmpFccuNcfStatus[3];
       uint32_t u32Tmp = 0;
       uint32_t ret_val = 0;
   
  for(u32Tmp = 0; u32Tmp < 3; u32Tmp++)
{
  /*1. Key for NCFS clearing*/
  FCCU.NCFK.R = 0xAB3498FE;
  /*2. Clear all the NCF status(OP12)*/
  FCCU.NCF_S[u32Tmp].R = 0xFFFFFFFF;
  /*3. wait untill switching to NORMAL mode*/
  while(FCCU.CTRL.B.OPS != 3);
  /*4. read NCF_S with vfnRead_FCCU_NCF_S and check if all the flag is cleared*/
  Read_FCCU_NCF_S(u32TmpFccuNcfStatus);
  if(u32TmpFccuNcfStatus[u32Tmp]!=0)
   ret_val = 1;
}
return ret_val;
  
}

 Best Regards,

0 Kudos
3,952 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

As I already explained.

No fault must be latched in FCCU_NCFSn registers in order to successfully execute FCCU state change.

There is no other issue.

Load my example and test it.

http://cache.nxp.com/files/microcontrollers/doc/app_note/AN5284.pdf?fsrch=1&sr=2&pageNum=1 

https://community.nxp.com/docs/DOC-103571 

Peter

0 Kudos
3,952 Views
cthhk
NXP Employee
NXP Employee

hi Peter:

One question appended.

In the reference manual there are 5 NCFS_CFG registers, so in header file there are NCFS_CFG[0~4] declared accordingly.

And every FCCU channel should be configured with two bits, in other words every NCFS_CFG[x] register should be mapped to 16 channels.

However in your demo code, NCFS_CFG[0].B.NCFSC14 is used to setup SWT reset, where SWT should be channel 14.

So how to link an FCCU channel with its NCFS_CFG bit?

Could you provide some more examples to show this?

Appreciate your help!

Best Regards,

Wang

0 Kudos
3,952 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

This is quite simple.

Open header file and check how FCCU_NCFS_CFG structure is defined.

You will instantly see that there are 2 bits assigned to each NCFSCxx.

Peter

0 Kudos
3,952 Views
lmonologue
Contributor I

Hi Peter,

I added the following code to your project's startup file(crt0.ppc), it work well and the result without debug tool is that the mcu is  reset periodically.But it can’t reset  without the part code.In your project,there is not the part code,so it can't work when I use your demo project directly. I would like to know whether there is any risk if I add the part code.I use ghs and trace32.

_start:

;#SWT0
e_lis r4, 0xFC05
e_or2i r4, 0x0000

e_li r3, 0xC520
e_stw r3, 0x10(r4)

e_li r3, 0xD928
e_stw r3, 0x10(r4)

e_lis r3, 0xFF00
e_or2i r3, 0x010A
e_stw r3, 0(r4)

#if defined(__ghs_asm)
.need exit

Thank you!

0 Kudos
3,952 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

I have enabled SWT by default in this example.

Just run it and check the Reset source. It will be FCCU soft reset.

And in FCCU you will see NCF14 -> SWT.

Peter

0 Kudos
3,952 Views
cthhk
NXP Employee
NXP Employee

Dear Peter:

The example works on my side. Thank you very much!

Best Regards,

Wang

0 Kudos