Hardware Reference
In-Depth Information
signii cant problems. Imagine a small sensor that connects to the Internet to
upload temperature readings to a server. If the IP address is stored in EEPROM,
and that memory location does not contain valid data, then your application
will attempt to upload data to a server that does not belong to you.
To prevent this, some designers add a reset button to their project. By adding
a few lines to your sketch, you can erase EEPROM data in the case of a i rst-
time power on, or if the Arduino board were changed. Some applications use
the control number for error checking, adding several numbers throughout
EEPROM memory for more reliability. Or, you could use a second sketch, one
that you upload that sets EEPROM data exactly as you want, before rel ashing
the i nal sketch. There are several solutions available; it all depends on what
solution is the best for you and your application. Don't trust EEPROM contents
on a new system; take the time necessary to prepare the nonvolatile memory.
Adding Nonvolatile Memory
Arduinos have limited EEPROM memory that is sufi cient for most programs,
but in some cases you might need to add EEPROM memory. Numerous EEPROM
components exist, for example the Atmel AT24C01A that adds 1 KB of memory,
or the AT24C16A that adds 16 KB of memory. However, these components are
connected to the I2C bus (explained in Chapter 8) and cannot be addressed by
the EEPROM library. The EEPROM library can handle only the internal EEPROM,
not external. If you want more external memory, it must be addressed by the
bus that it uses.
If you require large amounts of nonvolatile memory, other solutions exist.
Arduino shields exist that can accept SD or micro-SD cards. At the time of writ-
ing, micro-SD cards have capacities up to 128 gigabytes, more than enough for
most logging applications.
SD cards are based on l ash memory, and as such, also inherit l ash memory's
weakness: write cycles. However, most SD cards have an internal controller
that implements something called wear leveling , a technique used to limit the
amount of write cycles to a specii c place in memory. This greatly increases the
life expectancy of the l ash memory, allowing for normal i lesystem use, even
when i les are frequently updated. If you need nonvolatile memory that is often
changed, consider using an SD-card shield. SD-card operation is explained in
Chapter 12.
 
Search WWH ::




Custom Search