How to Interface an I2C EEPROM With the XE8000 Microcontroller Family

Technical Note TN8000.13
How to interface an I2C EEPROM
with the XE8000 Microcontrollers
TN8000.13
Technical Note
How to interface an I2C EEPROM with the
XE8000 Microcontroller family
Rev 1 Feb 2006
www.semtech.com
1
Technical Note TN8000.13
How to interface an I2C EEPROM
with the XE8000 microcontrollers
1 Introduction
This document shows how to connect and drive an I2C EEPROM with an XE8000 microcontroller. The application
reads information from an I2C EEPROM and sends it to the UART or gets data from the UART and sends it to the
EEPROM.
2 How does the example work?
The software example implements an interface between a PC (Personal Computer) and an I2C EEPROM trough
any of the XE8000 family microcontrollers.
You can find the software example code in zip format on the XEMICS web site. The zip file is named
eeProm_iic.zip.
In this example, the program starts by initialising two arrays with data. After this initialisation, it writes one of the
arrays to the EEPROM. Then it reads the contents of the EEPROM to the other array and sends it to the PC. Once
this initialisation is finished the software is waiting for a command from the PC.
The PC can send 3 types of commands to the microcontroller:
•
Connection Test
•
Write EEPROM
•
Read EEPROM
The PC communicates with the microcontroller through the UART peripheral using a very simple protocol. Once the
microcontroller has received all the data it sends them to the I2C EEPROM.
The microcontroller software project is divided into two major parts.
1. PC communication handling.
• The RS232CommHandler.c file contains all the functions that are necessary to handle the protocol
between the PC and the microcontroller.
2. I2C EEPROM communication handling
• The eeProm_iic.c file contains the High-level functions for the I2C EERPOM protocol.
• The eeProm_iic.h file contains pin assignments, definitions and macros.
The Initialisation.c file is necessary to initialise the different microcontroller peripherals such as ports clock and
UART.
To communicate with the UART, one must set the RC Oscillator frequency with a precision better or equal to 5%.
The DFLLDriver.c file does this.
The software starting point is located in the Main.c file.
© Semtech 2006
www.semtech.com
2
Technical Note TN8000.13
How to interface an I2C EEPROM
with the XE8000 microcontrollers
3 Instructions on how to use the eeProm_iic software
1. Connect the I2C EEPROM to the ProStart according to the illustration.
2. Unzip the eeProm_iic.zip file to your hard disk.
3. Load the project eeProm_iic.PRJ in RIDE.
4. Compile the Project
5. Upload the program to the ProStart.
6. Notes :
•
•
•
For a correct I2C function on the XE8000 daughter boards you need to disconnect the LEDs connected to
PortB [4] and PortB [5] by removing the corresponding jumpers.
Depending on which I2C EEPROM you use, the XE8000 internal pull up may be too big, then you will need an
external pull up (10kOhms).
Depending on the size of your EEPROM you need to address 8bits or 16bits, this can be changed by changing
the value of “#define DEV_ADDR_PTR 0” from 0 to 1 in the eeProm_iic.h file.
7. You need to have a RS232 Hexadecimal terminal. You can download a RS232 Hexadecimal terminal from the
following address: http://www.viddata.com/. This program is a shareware.
8. Set the following parameters in you terminal:
Baud rate
: 19200
Bit length
:8
Parity
: None
Stop bits
:1
Handshaking
: none
9. You need to type the following commands (without spaces):
Connection Test : 24 43 10 04
uC Answer
: 24 61 10 04
EEPROM Read
uC Answer
: 24 52 10 04
: 24 XX XX XX XX XX XX XX XX XX XX 61 10 04
EEPROM Write
uC Answer
: 24 57 XX XX XX XX XX XX XX XX XX XX 10 04
: 24 61 10 04
Where XX are the contents of the EEPROM or the values that you want to write.
© Semtech 2006
www.semtech.com
3
Technical Note TN8000.13
How to interface an I2C EEPROM
with the XE8000 microcontrollers
© Semtech 2006
All rights reserved. Reproduction in whole or in part is prohibited without the prior written consent of the copyright owner. The
information presented in this document does not form part of any quotation or contract, is believed to be accurate and reliable and
may be changed without notice. No liability will be accepted by the publisher for any consequence of its use. Publication thereof
does not convey nor imply any license under patent or other industrial or intellectual property rights. Semtech. assumes no
responsibility or liability whatsoever for any failure or unexpected operation resulting from misuse, neglect improper installation,
repair or improper handling or unusual physical or electrical stress including, but not limited to, exposure to parameters beyond
the specified maximum ratings or operation outside the specified range.
SEMTECH PRODUCTS ARE NOT DESIGNED, INTENDED, AUTHORIZED OR WARRANTED TO BE SUITABLE FOR USE IN
LIFE-SUPPORT APPLICATIONS, DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS. INCLUSION OF SEMTECH
PRODUCTS IN SUCH APPLICATIONS IS UNDERSTOOD TO BE UNDERTAKEN SOLELY AT THE CUSTOMER’S OWN RISK.
Should a customer purchase or use Semtech products for any such unauthorized application, the customer shall indemnify and
hold Semtech and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs damages and
attorney fees which could arise.
Contact Information
Semtech Corporation
Wireless and Sensing Products Division
200 Flynn Road, Camarillo, CA 93012
Phone (805) 498-2111 Fax : (805) 498-3804
© Semtech 2006
www.semtech.com
4