I have a problem with the wait states of the internal EEPROM of the LPC1857 and the LPCOpen library.
Till now I never had a problem, but now I had many devices which could not write to the EEPROM in the release version, the debug version was working fine.
I traced the problem to the wait states of the internal EEPROM of the LPC1857 and on the way found out that in the function "Chip_EEPROM_Init" the function "setWaitState" gets called and there some magic values get written into the wait states registers. With these values the EEPROM wont work with many processor here. But as it sometimes work, it seems to be a timing problem.
I commented out the call to "setWaitState" and now it seems to work with all devices, but how can I be sure?
So where do these magic values come from? Why are the values so small compared to the values which are in the registers after reset? Why does no other have this problem?
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
I´m not able to tell you the right circumstances, because I just found the problem to appear on some Hardware, but not all and the CPUs are all from the same week (triggering the problem and not triggering the problem).
As I´ve written, the problem are the wait states of the eeprom. In the LPCOpen version for the LPC1776 (which I´m also using and so needed to check if the problem is there too) is the code correct and also very good because it calculates the wait states with help of the CPU frequency. For the LPC1776 the manual is also right and also way better written and with more details.
The manual of the LPC1857 Needs be more precise on the EEPROM chapter and the calculation of the wait states. After some long time of searching I found that I need the times from the family manual. But there is a documentation error, the values for RPHASE1 and RPHASE2 need to be swapped and then it is correct.
Also the code in the LPCOpen for setting the wait states is wrong (these magic values).