MK22 Eeprom writing failure

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

MK22 Eeprom writing failure

1,062 Views
mayursavaj
Contributor III

Hi,

I am working on MK22FX512VLL12 controller. I am trying to write into some data into flex memory. I using below function

void writeEeprom(unsigned long addr, unsigned char data)

{

  *((uint8_t *)(addr)) = data; 

    /* Make sure the EEE is ready. If not wait for the command to complete */

    while(!(FTFE_FCNFG & FTFE_FCNFG_EEERDY_MASK));

}

my program unable to execute (!(FTFE_FCNFG & FTFE_FCNFG_EEERDY_MASK)); instruction.

Please any one help me to resolve this issue.

Thanks in advance.

Labels (1)
0 Kudos
Reply
6 Replies

781 Views
bobpaddock
Senior Contributor III

The wait should be before the data write, going by the comments. Wait for the PREVIOUS command to complete, if any. Are you saying it locks up at the wait or the wait does nothing at all?

781 Views
mayursavaj
Contributor III

Hi Bob Paddock,

Thanks for your reply.

Yes, it locks up at the wait or the wait does nothing at all.

But interestingly this was not happen to all microcontroller even though firmware and part no are same.

Please help me to resolve my issue.

0 Kudos
Reply

781 Views
rhysdrummond
Contributor III

Did you ever resolve this?  I'm hitting a similar issue porting from CW 10.6 to KDS 3.2 with a MK21FX512VMC12.

It hangs on the "while(!(FTFE_FCNFG & FTFE_FCNFG_EEERDY_MASK))" check in the KDS project.

The CW project works fine.

The only significant differences I can see in the generated code is in the IntFlashLdd1.c file, which seems to have different values in "SafeRoutine[]".  The settings via PE are identical though, so I don't know why this has changed.

Any thoughts anyone?

TIA

0 Kudos
Reply

781 Views
mayursavaj
Contributor III

Anyone help me to resolve this issue.

0 Kudos
Reply

781 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Mayur,

To provide the fastest possible support I want to point you to a similar question which has been answered on our Freescale community. Please refer to

https://community.freescale.com/message/538953#538953 and https://community.freescale.com/message/480552#480552 to view the details.

The FlexNVM feature (EEPROM) is implemented in the C90TFS flash driver, which comes with example projects. The driver can be downloaded from the next link:

http://cache.freescale.com/files/32bit/software/C90TFS_FLASH_DRIVER.exe

Have a great day,

Ping

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

781 Views
mayursavaj
Contributor III

Hi,

I have found that EEERDY bit is low in FTFE_FCNFG register. Can you tell me how to set FlexRAM as EEEPROM operation.

Thanks in advance.

freescale.png

0 Kudos
Reply