Writing EEPROM does not appear to be persistent when using example AN4570. MC9SO8PA4

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

Writing EEPROM does not appear to be persistent when using example AN4570. MC9SO8PA4

Jump to solution
3,909 Views
gregoryberardi
Contributor II

I am using the examples from AN4570. The example "EEPROM_ProgramUpto4Bytes". I am writing to location 0x3100 and the data is visible when using the "Memory Monitor" but when the chip is reset the data goes back to 0xFF.  I am erasing before writing and the functions are returning success. I am assuming that the BUSCLK is the 4MHz crystal that is clocking the chip (the datasheet is vague about this) so I have set FCLKDIV to 0x03 (3.6 to 4.6MHz). Any ideas on what I'm doing wrong?

Labels (1)
Tags (3)
1 Solution
2,973 Views
pavel_sadek
NXP Employee
NXP Employee

HI

Before command write sequence, NVM_FCLKDIV should be written to configure the flash clock to be between 0.8 and 1MHz.

be sure you are running the routine from RAM.

Pavel

View solution in original post

0 Kudos
24 Replies
518 Views
zbeehu
Contributor II

I also ran this code on myPA4TWR board -

then,I also close the watchdog

when I debug,it also show  NO source available for"0x0000(0x0000)()"

0 Kudos
517 Views
gregoryberardi
Contributor II

I have been trying to run the code in ram but have run into a problem. When I uncomment the lines that copy flash to ram, the debugger fails to launch. I get the error shown in the attached image (EEPROM_ERROR_DEBUG.png).

I am attaching the project that is giving me the issues. The copy lines are in the file hal_eeprom_init.c. Lines 58 and 60.

The chip that I'm running this on is a MC9S08PA4. There is only 512 bytes of ram. The two functions (erase and write) are a total of 204 bytes. I am left with a very small amount of RAM. Could I use the same ram space and copy the functions in as I need them?

Thank you in advance!

0 Kudos
517 Views
gregoryberardi
Contributor II

I have not been able to try running from ram but I believe that was my issue.

Thank you all!

2,974 Views
pavel_sadek
NXP Employee
NXP Employee

HI

Before command write sequence, NVM_FCLKDIV should be written to configure the flash clock to be between 0.8 and 1MHz.

be sure you are running the routine from RAM.

Pavel

0 Kudos