Flash driver problem with kea 128

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

Flash driver problem with kea 128

1,087 Views
manjunathkm
Contributor III

Dear All,

 

I am using KEA 128 microcontroller with s32 studio IDE. But i am facing problem with FLASH driver when i run continuously without step by step debugging.

 

I have configured bus clock frequency to 20MHZ, and FTMRE_FCLKDIV is configured to 0x13.

When i do step by step debug, I am able to erase and write any number of bytes but if i run at one shot, even the Erase is not working, instead hitting reset handler.

 

I have also attached my project for your reference.

 

Can somebody help me to find out the issue.

 

Regards,

Manjunath

Original Attachment has been moved to: FlashTest.zip

3 Replies

884 Views
manjunathkm
Contributor III

I found this working. I was not monitoring the status register for the operation complete, then after it is working fine.

Thanks,

Manjunath

884 Views
vignesh_vb_7
Contributor IV

Hi Manjunath,

                       I think you are not checking MGBUSY Flag(Memory controller busy flag) in status register FTMRE_FSTAT, before starting to send a new flash command.

Is that right?

0 Kudos
Reply

884 Views
manjunathkm
Contributor III

Hi Vignesh,

After I added the below part of the code, and its been called on every flash operaiton, it started working fine.

void FLASH_LaunchCMD(uint8_t bWaitComplete)
{
MCM->PLACR |= MCM_PLACR_ESFC_MASK; /* enable stalling flash controller when flash is busy */

FTMRE->FSTAT = 0x80;
if(bWaitComplete)
{
// Wait till command is completed
while (!(FTMRE->FSTAT & FTMRE_FSTAT_CCIF_MASK));
}
}

0 Kudos
Reply