Find help, specifications and source code for the LPC900. The LPC900 challenges Microchip and AVR based on the worlds most popular 8-bit architecture the 80C51. With a 2-clock core the LPC900 series is a high performance, very flexible and low cost 8-bit microcontroller family. Designers using or interested in these devices are encouraged to share their know-how and ask questions.
Need some help with the LPC901 and data flash storage. I'm using pin 7 as s digital input to determine when power is going to be lost. The hardware is setup such that pin 7 drops to a low level well before the chip itself powers down. When I see a 0 at pin 7 I write a counter value to flash at 0x02. The problem is that when I power the chip back up and read the counter value from flash sometimes the value seems to be fine other times it acts like the value being read is 0. I've tried simulating power down on pin 7 while maintaining power to the chip and this seems to work ok. Is something going on during power up of the chip that's causing the value that I have written to flash to change. Would appreciate any input on this.
--- In lpc900_users@lpc9..., "lgunseor" <lgunseor@...> wrote: > When I see a 0 at pin 7 I write a counter > value to flash at 0x02. The problem is that when I power the chip > back up and read the counter value from flash sometimes the value > seems to be fine other times it acts like the value being read is 0. > Hi there, I doubt that the location is being corrupted as power is reapplied. If this were possible then there is a greater chance of a valid program location being corrupted by the same mechanism than your written location. Some things to check: - that the signal on pin 7 is clean - the erase and program operation take 4ms and must be complete before you loose power (taking into account the worst case latency for testing pin 7). If the brownout detector fires before this is complete you may find the value is FFh or 00h depending on where in the erase cycle the abort occurred. If you are concerned about the integrity of the number stored then you could store it's compliment in the byte next door (pick an unused interrupt vector for 8-bytes of consecutive storage), or use some checksum scheme. I presume you are using the recommended erase/program command (as this preserves unaltered bytes in the page)? Regards, Phoebe
Phoebe, Thanks for the feedback. I'm using the "C" program examples provided in the LPC901/902/903 Users Manual for reading and writing to flash. I wish you could download the contents of the flash memory to see what values have been stored but you can't do that on the LPC900 series. I'm using the RTC to provide a 1 second cycle time through the RTC interrupt routinue. This provides my 1 second counter. I write the counter value to Flash if the voltage on pin 7 drops to a zero. I make sure that I globally disable all interrupts before writing or reading flash. For testing purposes I set a limit that when reached by the counter is written to the flash and turns on an LED. I disable the RTC and all interrupts at this point. When I power the system down and back up again the first thing I do is read the flash, compare it to the limit value (they should be the same if the flash value hasn't changed) and turn on the LED. When I power the system off and on sometime the LED light s telling me the value is the same and sometimes it doesn't meaning something has changed. Regards, Larry