How to Interface an External EEPROM with AVR Atmega32
In this article, we will explain how to communicate to an external EEPROM from the AVR Atmega32 MCU using the I2C communication protocol. So let’s begin our tutorial on how to interface an EEPROM (AT24C16A) with AVR Atmega32.
You will usually need an external EEPROM when your system has a certain set of user configurable settings that you need to save even when the system is powered off; so that the system starts with these configurations the next time it is powered on.
In this case, using an external EEPROM gives you the advantage of having a larger storage space (than the internal EEPROM inbuilt in Atmega32) in addition to keeping the user configurations safe from being lost even if the MCU fails.In this article, we will use the Atmel EEPROM AT24C16A. It is a 16K bit memory organized as 2048 word of 8 bits each (2048 Byte).
A0, A1 and A2 pins should be left unconnected for this specific EEPROM.The below drawing shows how to connect its pins to the Atmega32 I2C pins. You must make sure that pin 7 (WP is connected to ground) as this pin is a hardware write protection which won’t allow any writing operation to the memory unless it is grounded.
I2C Communication Protocol
I2C is a bus interface connection incorporated into many devices such as sensors, RTC (Real Time Clocks), and EEPROM. It is also referred to as Two-Wire Serial Interface (TWI) and it is ideal for communication between low-speed devices for a reliable communication over a short distance. The I2C protocol uses only 2 pins, one for clock (SCL) and one for Data (SDA). In Atmega32, these pins are pin22 (SCL) and pin23 (SDA). They are multiplexed over the I/O port C pins 0 and 1 respectively.
So, we will first configure and start the I2C protocol with the AVR microcontroller, and then we shall learn how to communicate with the EEPROM.
For more detail: How to Interface an External EEPROM with AVR Atmega32
Leave a Comment
You must be logged in to post a comment.