Watchdog operation during FLASH erase

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

Watchdog operation during FLASH erase

Jump to solution
2,194 Views
yixinwu
Contributor I

Hello community,

Now we are using the combination of MPC5744P and MC33907. The companion chip has a watchdog, which should be updated by the processor. The time window has been set as 32ms for example. We have also used the driver code from NXP (function as a hex constant) for FLASH erase, so we cannot put the watchdog update routine into this function, which means, during FLASH erase the watchdog cannot be updated.

A consideration is, the watchdog time window can be enlarged before FLASH erase and can be shortened after it. But the FLASH erase could take longer than 1 second, so the watchdog may not be updated even the largest time window for watchdog is used (1024ms). Is there any other (better) solution or suggestion? Thanks.

0 Kudos
Reply
1 Solution
1,826 Views
petervlna
NXP TechSupport
NXP TechSupport

Ok,

Here is example of callback function. It is for different micro, but I hope you can understand it. It will be same also for your micro.

Peter

View solution in original post

0 Kudos
Reply
8 Replies
1,826 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

Usually you do not erase whole flash at once, but you erase flash by blocks and you do update of watchdog between blocks erases.

I don't think that is safe to enlarge watchdog during flash erase and MPC5744P is safety class micro. As I am not familiar with your application and its requirements I can only recommend you to do flash erase by blocks and update watchdog between the erases.

Peter

0 Kudos
Reply
1,826 Views
yixinwu
Contributor I

Thank you for your reply!

Is there any sample code available how FLASH can be erased by blocks? Now I have something like this:

const UINT32 FlashErase_C[] =

    0x182106D0, 0x00801B01, 0x0910DD01, 0x480FC0E3, 0x7480063F,
    0x67E0C0CE, 0xE603CCD3, 0xE802C1D3, 0x67BCE206, 0x67DCE607, 
......

}

0 Kudos
Reply
1,826 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

Now I got info from colleague that there is callback function exactly for this reason.

It is described in drivers manual.

Peter

0 Kudos
Reply
1,825 Views
yixinwu
Contributor I

Could you please share this drivers manual? Because this code is adapted from some old source, I can't find the manual any more.

0 Kudos
Reply
1,825 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

You can just easily download whole driver with documentation from our web site...

http://www.nxp.com/assets/downloads/data/en/device-drivers/C55_JDP_SSD.exe 

Peter

0 Kudos
Reply
1,825 Views
yixinwu
Contributor I

Thank you very much.

I have checked the manual and the function FlashErase and the config of SSD is defined like this:

UINT32 FlashErase ( PSSD_CONFIG pSSDConfig,
                    UINT8 eraseOption,
                    UINT32 lowBlockSelect,
                    UINT32 midBlockSelect,
                    UINT32 highBlockSelect,
                    N256K_BLOCK_SEL n256KBlockSelect
                    );

typedef struct _c55_ssd_config

{

UINT32 c55RegBase;

UINT32 mainArrayBase;

BLOCK_INFO lowBlockInfo;

BLOCK_INFO midBlockInfo;

BLOCK_INFO highBlockInfo;

UINT32 n256KBlockNum;

UINT32 uTestArrayBase;

BOOL mainInterfaceFlag;

UINT32 programmableSize;

BOOL BDMEnable;

} SSD_CONFIG, *PSSD_CONFIG;

I don't understand how a callbak function can be transferred when I use this function.

In our last generation of product we have used MPC5533 and in the source code I find the FlashErase is defined like this:

typedef UINT32 (*pFLASHERASE) (
                PSSD_CONFIG pSSDConfig,
                BOOL shadowFlag,
                UINT32 lowEnabledBlocks,
                UINT32 midEnabledBlocks,
                UINT32 highEnabledBlocks,
                void (*CallBack)(void)
               );

There was this transfer of CallBack function.

0 Kudos
Reply
1,827 Views
petervlna
NXP TechSupport
NXP TechSupport

Ok,

Here is example of callback function. It is for different micro, but I hope you can understand it. It will be same also for your micro.

Peter

0 Kudos
Reply
1,825 Views
yixinwu
Contributor I

I have figured out, that we have done FlashCheckStatus immediately after FlashErase. The status check has costet a long time, which kills my watchdog rountine. Now I do the status check with a time delay and the problem should be solved now. Thank you very much for your support.

0 Kudos
Reply