Interfacing the internal serial EEPROM

Similar documents
CAN Microcontrollers. Application Note. Migrating from T89C51CC01 to AT89C51CC03. Feature Comparison

AT17F Series. Application Note. Programming Circuits for AT17F Series Configurators with Xilinx FPGAs. 1. Introduction

Rad Hard FPGA. AT40KEL-DK Design Kit Content. Description. Kit Content. Reference Material. Support

AT89ISP Programmer Cable Introduction AT89ISP Programmer Cable Parallel Port Settings Application Note AT89ISP Software AT89ISP Cable polarized

8-bit Microcontroller. Application Note. AVR320: Software SPI Master

AT91 ARM Thumb Microcontrollers. Application Note. AT91 Host Flash Loader. 1. Package Contents. 2. Definition of Terms. 3.

8051 Microcontrollers. Application Note. Migration from AT89C5131 & AT89C5131A-L to AT89C5131A-M

Application Note. Microcontrollers. Using Keil FlashMon Emulator with AT89C51CC01/03 AT89C51CC01/ Summary. 2. Background overview

AT17 Series FPGA. Configuration Memory. Application Note. In-System Programming Circuits for AT17 Series Configurators with Atmel and Xilinx FPGAs

CAN, 80C51, AVR, Microcontroller. Application Note

TSC695. Application Note. Annulled Cycle Management on the TSC695. References

FPGA Configuration EEPROM Memory. Application Note. Programming Atmel s EEPROMs: AT17LV020(A) vs. AT17LV002(A) Introduction.

AVR32 UC3 Software Framework... User Manual

AT17(A) Series FPGA Configuration Memory. Application Note

Section 1 ATAVRAUTOEK1 Getting Started

MARC4. Application Note. Hints and Tips for Hard- and Software Developments with MARC4 Microcontrollers

AT89STK-09 Starter Kit for AT83C26... User Guide

Two-wire Serial EEPROM Smart Card Modules 128K (16,384 x 8) 256 (32,768 x 8) AT24C128SC AT24C256SC. Features. Description VCC NC

AT89STK-10 Starter Kit... Hardware User Guide

Trusted Platform Module AT97SC3203S. SMBus Two-Wire Interface. Summary

Two-Wire Serial EEPROM AT24C164 (1)

8-bit RISC Microcontroller. Application Note. AVR 305: Half Duplex Compact Software UART

8-bit RISC Microcontroller. Application Note. AVR151: Setup And Use of The SPI

AT91 ARM Thumb Microcontrollers. Application Note. AT91M55800A Clock Switching Considerations using Advanced Power Management Controller.

AT89C5131 Starter Kit... Software User Guide

MP3 Player Reference Design Based on AT89C51SND1 Microcontroller... User Guide

a clock signal and a bi-directional data signal (SCL, SDA)

ATAVRAUTO User Guide

Two-wire Serial EEPROM Smart Card Modules 1K (128 x 8) 2K (256 x 8) 4K (512 x 8) 8K (1024 x 8) 16K (2048 x 8)

2-Wire Serial EEPROM AT24C01. Features. Description. Pin Configurations. 1K (128 x 8)

8-bit Microcontroller. Application Note. AVR031: Getting Started with ImageCraft C for AVR

AVR501: Replacing ATtiny15 with ATtiny25. 8-bit Microcontrollers. Application Note PRELIMINARY. Features. 1 Introduction

FPGA Configurator Programming Kit (Enhanced) ATDH2200E. Features. Description

8-bit Microcontroller. Application Note. AVR030: Getting Started with C for AVR

2-wire Serial EEPROM AT24C21. 2-Wire, 1K Serial EEPROM. Features. Description. Not Recommended for New Designs. Pin Configurations.

ATAVRAUTO User Guide

GemCore Serial Lite PRO AT83C21GC. Summary

Migration From AT89C51SND1C to AT83C51SDN1C. Application Note. MP3 Microcontrollers

2-wire Serial EEPROM Smart Card Modules AT24C32SC AT24C64SC

256K (32K x 8) 5-volt Only Flash Memory AT29C256

SAM Boot Assistant (SAM-BA)... User Guide

256K (32K x 8) 5-volt Only Flash Memory AT29C256

Application Note Microcontrollers. C Flash Drivers for T89C51RC/RB/IC2 and AT89C51RC/RB/IC2 for Keil Compilers

System Designer. Programmable SLI AT94K/AT94S Series. Features. Description

System Designer. Programmable SLI AT94K/AT94S Series. Features. Description

2-wire Serial EEPROM AT24C1024. Features. Description. Pin Configurations. 1M (131,072 x 8)

256 (32K x 8) High-speed Parallel EEPROM AT28HC256N. Features. Description. Pin Configurations

64K (8K x 8) High Speed Parallel EEPROM with Page Write and Software Data Protection AT28HC64BF

AVR1303: Use and configuration of IR communication module. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

32-bit Secure. AT91SC CT-USB Summary. Microcontrollers. Features

3-Wire Serial EEPROM AT93C46C

1-megabit (128K x 8) 5-volt Only Flash Memory AT29C010A

2-megabit (256K x 8) 5-volt Only Flash Memory AT29C020

4-megabit (512K x 8) 3-volt Only 256-byte Sector Flash Memory AT29LV040A

8-megabyte, 4-megabyte, and 2-megabyte 2.7-volt Only DataFlash Cards AT45DCB008D AT45DCB004D AT45DCB002D. Not Recommended for New Design

2-wire Serial EEPROMs AT24C128 AT24C256

AVR32752: Using the AVR32 UC3 Static Memory Controller. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

2-wire Serial EEPROM AT24C01A AT24C02 AT24C04 AT24C08 AT24C16

AT94K Series Field Programmable System Level Integrated Circuit. Application Note. FPSLIC Baud Rate Generator

512K (64K x 8) 5-volt Only Flash Memory AT49F512

8-bit Microcontroller. Application Note. AVR201: Using the AVR Hardware Multiplier

2-wire Serial EEPROM AT24C512. Preliminary. 2-Wire Serial EEPROM 512K (65,536 x 8) Features. Description. Pin Configurations.

64K (8K x 8) Parallel EEPROM with Page Write and Software Data Protection AT28C64B. Features. Description. Pin Configurations

8-bit Microcontroller with 2K/4K/8K Bytes In-System Programmable Flash. Appendix A. Preliminary. ATtiny261 ATtiny461 ATtiny861 Automotive

4-megabit (512K x 8) Single 2.7-volt Battery-Voltage Flash Memory AT49BV040A

AT85DVK-07 Demonstration Firmware... User s Manual

AT697E. Application Note. Checking AT697E Code for Occurrence of LDF/FPOPd Instructions Sequence with a dependency on an Odd-Numbered Register

AVR based 125kHz RFID Evaluation Kit (Re)Programming Guide ATA2270-EK1. Overview. Fuse Settings: ISP Programming

1-megabit (64K x 16) 3-volt Only Flash Memory AT49BV1024A AT49LV1024A

Programmable SLI AT40K AT40KAL AT94K. Application Note. Implementing a Single-coefficient Multiplier

AT91 ARM Thumb Microcontrollers. Application Note. Using the ECC Controller on AT91SAM9260/9263 and AT91SAM7SE Microcontrollers. 1.

AVR1315: Accessing the XMEGA EEPROM. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

4-megabit (512K x 8) Flash Memory AT49BV040B

2-wire Serial EEPROM AT24C01A AT24C02 AT24C04 AT24C08 AT24C16. Features. Description. Pin Configurations. 1K (128 x 8) 2K (256 x 8) 4K (512 x 8)

hex file. The example described in this application note is written for the AT94K using the FPSLIC Starter Kit. Creating a New Project

80C51 MCUs T89C51AC2. Errata Sheet

DatasheetDirect.com. Visit to get your free datasheets. This datasheet has been downloaded by

DIP Top View VCC A12 A14 A13 A6 A5 A4 A3 A2 A1 A0 A8 A9 A11 A10 I/O7 I/O6 I/O0 I/O1 I/O2 I/O5 I/O4 I/O3 GND. TSOP Top View Type 1 A11 A9 A8 A13 A14

2-wire Serial EEPROM AT24C01A AT24C02 AT24C04 AT24C08 AT24C16

AT89C5122. Application Note. Preventing Windows XP from Displaying Unknown device Message at Startup

2-Wire Serial EEPROM 32K (4096 x 8) 64K (8192 x 8) AT24C32A AT24C64A. Features. Description. Pin Configurations

2-wire Serial EEPROM AT24C512

AVR1922: Xplain Board Controller Firmware 8-bit Microcontrollers Application Note Features 1 Introduction

512K (64K x 8) 5-volt Only Flash Memory AT29C512

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATtiny87 ATtiny167 Automotive

8-bit Microcontroller. Application Note. AVR033: Getting Started with the CodeVisionAVR C Compiler

AVR097: Migration between ATmega128 and ATmega1281/ATmega bit Microcontrollers. Application Note. Features. 1 Introduction

AT91SAM-ICE... User Guide

Two-wire Serial EEPROM AT24C512

CryptoRF EEPROM Memory 8 Kbits

When is Data Susceptible to Corruption

CryptoMemory 64 Kbit AT88SC6416C. Summary. Features. Table 1. Pin Configuration

2-megabit (256K x 8) 3-volt Only Flash Memory AT29LV020

ARM7TDMI - based Microcontroller AT91RM3400. Errata Sheet

Battery-Voltage. 4-megabit (512K x 8/ 256K x 16) Single 2.7-volt. Flash Memory AT49BV4096A AT49LV4096A

AT91 ARM Thumb-based Microcontroller. Application Note. AT91SAM7X and AT91SAM7XC Microcontroller Series Schematic Check List. 1.

APPLICATION NOTE. Atmel AT01080: XMEGA E Schematic Checklist. Atmel AVR XMEGA E. Features. Introduction

2-wire Serial EEPROMs AT24C128 AT24C256. Features. Description. Pin Configurations. 128K (16,384 x 8) 256K (32,768 x 8)

AVR532: Migration from ATmega48/88/168 to ATmega48A/88A/168A. 8-bit Microcontrollers. Application Note. 1 Introduction

1-megabit (64K x 16) 3-volt Only Flash Memory AT49LV1024 AT49LV1025

Transcription:

Interfacing the internal serial EEPROM Stacked into the AT8xEB5114 8051 Microcontrollers 1. Overview The AT8xEB5114 contains an internal serial EEPROM (AT24C02) connected to the microcontroller via two standard ports. This application note aims to help developers take advantage of all the EEPROM characteristics. The AT8xEB5114 is connected to the EEPROM via two standard C51 bidirectional port bits. In order to have the equivalent to a standard TWI (Two Wire Interface) line (open drain with pull-up of few KΩs) with a maximum speed, the bi-directional port bits must be controlled with particular care. The EEPROM and the microcontroller have their own internal brown-out protections, with different thresholds. This means that power supply disturbances can generate a reset on one die whereas the other is still running. The consequence can be a data corruption which can be avoided by implementing special subroutines described in this document. Application Note Rev.

2. AT24C02 Internal Connection The internal connection of the EEPROM is shown on Figure 2-1. Figure 2-1. EEPROM and Microcontroller Connections AT8xEBC5114 Vcc A0 A1 A2 WP AT24 C02 Vcc SDA SCL GND P3.6 P3.7 Vss The Vcc and ground pins of the EEPROM are directly connected to the Vcc and the Vss pins of the AT8xEB5114. The SCL and the SDA pins of the EEPROM are internally bonded to the P3.6 and P3.7 ports of the AT8xEB5114. The other pins (Device/page address and WP) are left unconnected. Internal pull-downs in AT24C02 drive A0, A1, A2 and WP to a Low level. 2.1 Standards TWI Line Typically, a standard TWI bus is an open drain transistor connected to the Vcc via a pull-up resistor. The drain is also connected to the Vss pin via the parasitic capacitances. This RC association gives a time constant which gives the maximum speed reachable for the TWI line. This TWI line can be simplified as shown in Figure 2-2. 2 AT8xEB5114 Application Note

AT8xEB5114 Application Note Figure 2-2. Typical TWI Output Stage Vdd Vcc AT24C02 SDA Control GND Rpull-up Cbus load SDA Bus Line The pull-up resistor can be external or integrated on-chip. The Bus load capacitor is the sum of all the parasitic capacitances of all the chips connected to the line. 2.2 EEPROM Ports Characteristics The EEPROM output ports are standard, with a maximum capacitance on SDA pin of 8pF. 2.3 AT8xEB5114 Port Characteristics The AT8xEB5114 ports are standard C51 bidirectional ports. The SCL pin of the EEPROM is an input only, so the SCL pin of the microcontroller can be configured as a push-pull output port in order to obtain the fastest transient as possible. Concerning the SDA pin, it is not possible to configure the microcontroller port as a push-pull output, because SDA pin is sometimes an input and sometimes an output. There is no pull-up on the AT24C02, and there is no additional pull-up on the SDA line. So the SDA pull-up is only made by the AT8xEB5114 SDA port pin. When the AT8xEB5114 port pin is configured as a quasi-bidirectional port, the pull-up resistor is about 100-150KΩs when the port pin is low and around 10KΩ when the port pin is high. This means that for a low to high transition, while the level is less than the Vil level, the pull up is 10 times higher than when it has reached this level. It also means that the rising edge is spit into two phases as shown on Figure 2-3. 3

Figure 2-3. Rising time of a bidirectional externally loaded with a 12pF capacitor Medium pull-up activation (~10KOhms) Vil Weak pull-up (~100KOhms) 2.4 Potential Problem Description in Case of High Speed Transmission On the TWI protocol, the low level can be driven either by the microcontroller or by the EEPROM. Nevertheless, the High level is only driven by the pull-up resistor. In the present case, the pull-up is integrated into the microcontroller. But as explained before, the pull-up value is quite high and the rising-time can be relatively slow. When the microcontroller drives the SDA data line there is absolutely no problem, because the 0 to 1 transition is helped during two clock periods of the microcontroller by a strong pull-up transistor with a resistor value of few tens of Ohms. When the microcontroller receives data from the EEPROM, the rising edge is guaranteed only by the pull-up resistor of the microcontroller. A problem that may occur is that the microcontroller reads a low level instead of a high level because the pull-up has not been able to raise the SDA pin as fast as expected by the EEPROM which relied on the pull-up to ensure the high level. 2.5 Software Solution There is a software solution for the above problem. Each time the microcontroller has to proceed a Low to High transition on a pin, the pin is driven High thanks to the strong transistor of only few tenths of Ohms during two clock periods. Moreover, the microcontroller controls the clock of the protocol. Therefore, just before setting the clock in order to read the data, it can make a High to Low transition (because the port is constantly configured as a High level in bidirectional mode) followed by the Low to high transition which allows the strong transistor for a while. In case the EEPROM would like to transmit a low level, it has no effect, and in case the EEPROM would like to transmit an high level, it considerably helps the rising time. This software solution allows to use the EEPROM at its maximum frequency value. 4 AT8xEB5114 Application Note

AT8xEB5114 Application Note 3. EEPROM Brown Out and Microcontroller Power Fail Detect 3.1 AT8xEB5114 Power Fail Detect (PFD) Threshold Levels The AT8xEB5114 is a typical 3.3V microcontroller. It provides Power On Reset and Power Fail Detect threshold levels defined as in Table 3-1. Table 3-1. AT8xEB5114 PFD levels Symbol Parameter Min Typ Max Unit VPFDP Power fail high level threshold 2.6 2.8 2.95 V VPFDM Power fail low level threshold (default) 2.45 2.5 2.7 V Power fail hysteresis VPFDP - VPFDM 190 230 260 mv This means that the microcontroller is under reset with a Vcc voltage value from 0 up to 2.7V. 3.2 AT24C02 Brown-Out Threshold Level The EEPROM typical Power fail detect value is about 1.2V. 3.3 Potential Problem Due to the difference of PFD level between the EEPROM and the Microcontroller, one part can be under reset while the other one is still running. As the PFD level of the EEPROM is lower than the AT8xEB5114, it appears necessary that the microcontroller resets the EEPROM each time it has itself been reset. 3.4 Resetting the EEPROM Usually, the TWI protocol is reset when a start condition is applied on the TWI pins. A start sequence consists of a falling edge on the SDA line while the SCL line is high. To generate a start condition, it is necessary to set the SDA line to 1. This can be done by the weak pull-up of the port while the microcontroller is under reset. But, due to the high pull-up value of the AT8xEB5114 port, it can take a long time before having this condition satisfied, and in case the EEPROM is outputting a low level, it is absolutely impossible to have... even with the strong transistor which would only produce a a spike on the SDA line. In order to reset the EEPROM, the best solution is to proceed as follows: Make the clock toggles as long as there is not a high Level on the SDA pin while the SCL pin is high. As soon as this condition is satisfied (SDA High while SCL is also High), make a START by driving low the SDA pin while the SCL pin is still high. After this first start, which has reset the TWI line you can create a STOP (by making a transition from low a High level on the SDA pin while the SCL is High), then you are certain that your protocol has been properly reset, and that no untimely data can be transmitted to the EEPROM while no other START has been processed. 5

AT8xEB5114 Application Note 3.5 C-code 3.6 Examples void TWI_Init_EEP(void) { // Init ports being sure there is no operation SDA_INT = 0; SCL_INT = 0; SDA_INT = 1; SCL_INT = 1; while (SDA_INT == 0){ // Check SDA is high while SCL is also high SCL_INT = 0; SDA_INT = 0; // Try to force SDA to High level... SDA_INT = 1; //..thanks to the fast software pull-up SCL_INT = 1; } // Generate a START to reset the protocol SDA_INT = 0; SCL_INT = 0; // Generate a STOP to be sure no data can be untimely transmitted SCL_INT = 1; SDA_INT = 1; // The EEPROM protocol is now reset and waits for the next instruction } The two following diagrams illustrate what happens when the microcontroller is reset while the EEPROM is still correctly operating. Figure 3-1. illustrates an example where the AT8xEB5114 has requested a read data, and the data contains several 0. Figure 3-1. Microcontroller reset while the EEPROM is sending 0 RST P3.6 = SDA Spikes generated by the strong pull-up activation Standard bidirectional micrcontroller pull-up effect P3.7 = SCL 0 1 0 0 0 0 EEPROM READING SEQUENCE RESET START STOP EEPROM READY 6

AT8xEB5114 Application Note The small spikes seen on the SDA pin correspond to the software pull-up which tries to rise the SDA pin. The special rising edge on the SCL pin during the AT8xEB5114 is reset is due the standard bidirectional port pull-up resistor. Just after the reset, the microcontroller has to transfer two dummy 0 data bits before being able to reset the EEPROM protocol. Figure 3-2. illustrates an example of AT8xEB5114 reset while the EEPROM does not hold the SDA line to 0. Figure 3-2. Microcontroller reset while the EEPROM is not driving a 0 RST P3.6 = SDA P3.7 = SCL 0 0 1 0 1 MICROCONTROLLER SENDING DATA RESET START STOP EEPROM READY There is no spike visible because in this case only the microcontroller is transmitting data to the EEPROM. The special rising edge of the SCL pin during the microcontroller is reset is due the standard bidirectional port pull-up resistor. 3.7 Remarks 4. References The protocol mentioned allows to ensure a proper reset of the TWI protocol. Nevertheless, it is not exactly the same as if the EEPROM has been reset by a power lost. In case of loss of power, the internal pointer of the EEPROM is reset. In case of protocol reset, the internal pointer is not reset. If the application firmware starts with a sequential read, take care to reset the pointer thanks to a dummy write. AT8xC5114 Datasheet 24C02 Serial EEPROM Datasheet. 7

Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Regional Headquarters Europe Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500 Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Atmel Operations Memory 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 Microcontrollers 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France Tel: (33) 2-40-18-18-18 Fax: (33) 2-40-18-19-60 ASIC/ASSP/Smart Cards Zone Industrielle 13106 Rousset Cedex, France Tel: (33) 4-42-53-60-00 Fax: (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906, USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743 RF/Automotive Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906, USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France Tel: (33) 4-76-58-30-00 Fax: (33) 4-76-58-34-80 Literature Requests www.atmel.com/literature Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL S TERMS AND CONDI- TIONS OF SALE LOCATED ON ATMEL S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDEN- TAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically providedotherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel satmel s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. Atmel Corporation 2005. All rights reserved. Atmel, logo and combinations thereof, are registered trademarks, and Everywhere You Are are the trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. Printed on recycled paper.