lpc4078 eeprom page erase clarification required

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

lpc4078 eeprom page erase clarification required

438 Views
alex_conway
Contributor II

I'm using an LPC4078 and MCUXpresso and experimenting with storing values in Eeprom.

I want to write a few bytes in the middle of a page without clearing the whole page.

Looking in the datasheet, it says that after writing the data to be written int he page register, it still has to be programmed into non-volatile memeory and that is done with the erase/program operation.

Does the Erase/Program operation erase the whole page or just the area of the page I have new data for, and how does it know? - the address setting for Erase/Program ignores the 6 lsbs so it only knows the page.

The UM10562.pdf isn't explicitly clear on this matter.

Thanks

Alex

0 Kudos
Reply
4 Replies

165 Views
alex_conway
Contributor II

I've got semihosting to work after adding a newline to all my printf strings! Also clearer evidence of everything I have said:
Erasing sets Eeprom to 0x00
The code does not perform a read-modify-erase-write sequence, just erase-write.
The LPC4078 seems to only erase the locations that are written to when erasing.

I would really like clarification on this.

Thanks

Alex

0 Kudos
Reply

353 Views
alex_conway
Contributor II

I attach a workspace with the mentioned project in it. I ran it on an LPC4078 using a lpc-link2 debugger.
(I couldn't be bothered to get semihosting to work, so I used breakpoints and inspected the data)

0 Kudos
Reply

353 Views
alex_conway
Contributor II

Hi Alice,

My experiments demonstrate otherwise:

I wrote a small program using the lpc_board_ea_devkin_4088 library and the periph_eeprom demo project to start me up.

I erase a page of Eeprom and read it back. To my surprise the results are all '\0' instead of 0xFF

Then I write 'ABCDEFG\0' to address 0 in that page and read the page back. I receive 'ABCDEFG\0'

Then I write 'ABCDEFG\0' to address 7 in that page and read the page back. I receive 'ABCDEFGABCDEFG\0'

This is all as expected except for two things:

1. after erasing the eeprom reads 0

2. looking at the implementation of Chip_EEPROM_Write() is can seem no read-modify-erase-write sequence. There is only Chip_EEPROM_WritePageRegister followed by Chip_EEPROM_EraseProgramPag.

This is why I asked the question.

Thanks

Alex

0 Kudos
Reply

360 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @alex_conway 

For LPC4078 EEPROM, the minimum erase/program unit is one page (64 bytes). Therefore, each erase/program operation will erase the entire page. If you want to write only a few bytes, please first read the whole page, then modify the required bytes, and finally perform an erase/program operation on the page. You can test this on your side.
 
Thank you.
 
BR
Alice
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2349454%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Elpc4078%20eeprom%20page%20erase%20clarification%20required%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2349454%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI'm%20using%20an%20LPC4078%20and%20MCUXpresso%20and%20experimenting%20with%20storing%20values%20in%20Eeprom.%3C%2FP%3E%3CP%3EI%20want%20to%20write%20a%20few%20bytes%20in%20the%20middle%20of%20a%20page%20without%20clearing%20the%20whole%20page.%3C%2FP%3E%3CP%3ELooking%20in%20the%20datasheet%2C%20it%20says%20that%20after%20writing%20the%20data%20to%20be%20written%20int%20he%20page%20register%2C%20it%20still%20has%20to%20be%20programmed%20into%20non-volatile%20memeory%20and%20that%20is%20done%20with%20the%20erase%2Fprogram%20operation.%3C%2FP%3E%3CP%3EDoes%20the%20Erase%2FProgram%20operation%20erase%20the%20whole%20page%20or%20just%20the%20area%20of%20the%20page%20I%20have%20new%20data%20for%2C%20and%20how%20does%20it%20know%3F%20-%20the%20address%20setting%20for%20Erase%2FProgram%20ignores%20the%206%20lsbs%20so%20it%20only%20knows%20the%20page.%3C%2FP%3E%3CP%3EThe%20UM10562.pdf%20isn't%20explicitly%20clear%20on%20this%20matter.%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EAlex%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2350171%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc4078%20eeprom%20page%20erase%20clarification%20required%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2350171%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20attach%20a%20workspace%20with%20the%20mentioned%20project%20in%20it.%20I%20ran%20it%20on%20an%20LPC4078%20using%20a%20lpc-link2%20debugger.%3CBR%20%2F%3E(I%20couldn't%20be%20bothered%20to%20get%20semihosting%20to%20work%2C%20so%20I%20used%20breakpoints%20and%20inspected%20the%20data)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2350013%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc4078%20eeprom%20page%20erase%20clarification%20required%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2350013%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F177132%22%20target%3D%22_blank%22%3E%40alex_conway%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3EFor%20LPC4078%20EEPROM%2C%20the%20minimum%20erase%2Fprogram%20unit%20is%20one%20page%20(64%20bytes).%20Therefore%2C%20each%20erase%2Fprogram%20operation%20will%20erase%20the%20entire%20page.%20If%20you%20want%20to%20write%20only%20a%20few%20bytes%2C%20please%20first%20read%20the%20whole%20page%2C%20then%20modify%20the%20required%20bytes%2C%20and%20finally%20perform%20an%20erase%2Fprogram%20operation%20on%20the%20page.%20You%20can%20test%20this%20on%20your%20side.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EThank%20you.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EBR%3C%2FDIV%3E%0A%3CDIV%3EAlice%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2350160%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc4078%20eeprom%20page%20erase%20clarification%20required%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2350160%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Alice%2C%3C%2FP%3E%3CP%3EMy%20experiments%20demonstrate%20otherwise%3A%3C%2FP%3E%3CP%3EI%20wrote%20a%20small%20program%20using%20the%20lpc_board_ea_devkin_4088%20library%20and%20the%20periph_eeprom%20demo%20project%20to%20start%20me%20up.%3C%2FP%3E%3CP%3EI%20erase%20a%20page%20of%20Eeprom%20and%20read%20it%20back.%20To%20my%20surprise%20the%20results%20are%20all%20'%5C0'%20instead%20of%200xFF%3C%2FP%3E%3CP%3EThen%20I%20write%20'ABCDEFG%5C0'%20to%20address%200%20in%20that%20page%20and%20read%20the%20page%20back.%20I%20receive%26nbsp%3B'ABCDEFG%5C0'%3C%2FP%3E%3CP%3EThen%20I%20write%26nbsp%3B'ABCDEFG%5C0'%20to%20address%207%20in%20that%20page%20and%20read%20the%20page%20back.%20I%20receive%26nbsp%3B'ABCDEFGABCDEFG%5C0'%3C%2FP%3E%3CP%3EThis%20is%20all%20as%20expected%20except%20for%20two%20things%3A%3C%2FP%3E%3CP%3E1.%20after%20erasing%20the%20eeprom%20reads%200%3C%2FP%3E%3CP%3E2.%20looking%20at%20the%20implementation%20of%26nbsp%3B%3CSPAN%3EChip_EEPROM_Write()%20is%20can%20seem%20no%20read-modify-erase-write%20sequence.%20There%20is%20only%20Chip_EEPROM_WritePageRegister%20followed%20by%26nbsp%3BChip_EEPROM_EraseProgramPag.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20is%20why%20I%20asked%20the%20question.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EAlex%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2355320%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc4078%20eeprom%20page%20erase%20clarification%20required%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2355320%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI've%20got%20semihosting%20to%20work%20after%20adding%20a%20newline%20to%20all%20my%20printf%20strings!%20Also%20clearer%20evidence%20of%20everything%20I%20have%20said%3A%3CBR%20%2F%3EErasing%20sets%20Eeprom%20to%200x00%3CBR%20%2F%3EThe%20code%20does%20not%20perform%20a%20read-modify-erase-write%20sequence%2C%20just%20erase-write.%3CBR%20%2F%3EThe%20LPC4078%20seems%20to%20only%20erase%20the%20locations%20that%20are%20written%20to%20when%20erasing.%3C%2FP%3E%3CP%3EI%20would%20really%20like%20clarification%20on%20this.%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EAlex%3C%2FP%3E%3C%2FLINGO-BODY%3E