Menu ▾ ▴

#145 Bug in LPC18x EEPROM write and read functions

All Platforms
closed-invalid
None
5
2015-11-16
2015-11-10
No

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)

1 Attachments

Discussion

  • Uwe Bonnes

    Uwe Bonnes - 2015-11-10

    Does this bug apply to SVN HEAD? I don't see lpc185x_eeprom.c there.

     
  • André Malafaya Baptista

    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.

     
  • Uwe Bonnes

    Uwe Bonnes - 2015-11-11

    What about making the LPC18 support "officially"?

     
  • André Malafaya Baptista

    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.

     
  • Ole Reinhardt

    Ole Reinhardt - 2015-11-16

    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

     
  • Ole Reinhardt

    Ole Reinhardt - 2015-11-16
    • status: open --> closed-invalid
    • assigned_to: Ole Reinhardt
     

Log in to post a comment.