Bug in LPC18x EEPROM write and read functions.
When pEepromMem is recalculated to the start of a new page inside the loop, the index (i) is not adjusted to the new address. Example:
[page 0; offset 0]
pEepromMem = 0x20040000; i = 0 ==> Effective address = 0x20040000
pEepromMem = 0x20040000; i = 1 ==> Effective address = 0x20040001
pEepromMem = 0x20040000; i = 2 ==> Effective address = 0x20040002
...
pEepromMem = 0x20040000; i = 127 ==> Effective address = 0x2004007F
[Changing to page 1; offset 0]
pEepromMem = 0x20040080; i = 128 ==> Effective address = 0x20040100 <-- should have been 0x20040080
After this, if you try to read contents at position 128 (page1), you won't find what was expected to have been written.
Find attached a possible solution (my changes are marked with comments AMB)
Does this bug apply to SVN HEAD? I don't see lpc185x_eeprom.c there.
No, sorry. Despite the header, the file seems to be "rogue". Apparently, it doesn't exist officially. You may drop the bug if you wish.
What about making the LPC18 support "officially"?
That would be great. I'm currently evaluating Ethernut for LPC17xx or LPC18xx, so it would be welcome. But in case you're wondering, I didn't author that file.
This code does not match any Nut/OS code. There is LPC18xx port available yet.
It looks like someone copied and modified the code.
As the bug does not apply to any of the existing routines, I close this ticket as closed-invalud