AN1096 Datasheet PDF - Microchip


www.Datasheet-PDF.com

AN1096
Microchip

Part Number AN1096
Description Using the C30 Compiler to Interface SPI Serial EEPROMs
Page 12 Pages

AN1096 datasheet pdf
View PDF for PC
AN1096 pdf
View PDF for Mobile


No Preview Available !

AN1096
Using the C30 Compiler to Interface SPI Serial EEPROMs
with dsPIC33F and PIC24F
Author: Martin Kvasnicka
Microchip Technology Inc.
INTRODUCTION
The 25XXX series serial EEPROMs from Microchip
Technology are SPI compatible and have maximum
clock frequencies ranging from 3 MHz to 20 MHz. Many
times when designing an application which utilizes a
serial EEPROM device, it may be beneficial to use a
microcontroller which does not feature a dedicated
protocol-specific serial port. This can be due to several
possible reasons, including size restrictions or costs. In
these instances, it is required of the designer to write
software routines capable of generating the proper
signals for communicating with the EEPROM device.
This application note provides assistance and source
code to ease the design process of interfacing a
Microchip dsPIC33F Digital Signal Controller to a
Microchip SPI serial EEPROM, without the use of a
hardware serial port.
Figure 1 describes the hardware schematic for the
interface between Microchip’s 25XXX series devices
and the dsPIC33F DSC or PIC24F PIC® microcontrol-
ler. The schematic shows the connections necessary
between the DSC or PIC MCU and the serial EEPROM
as tested, and the software was written assuming
these connections. The WP and HOLD pins are tied to
VCC through resistors, because the write-protect and
hold features are not used in the examples provided.
FIGURE 1:
CIRCUIT FOR dsPIC33F256GP710, PIC24FJ128GA010 AND 25XXX SERIES
DEVICES
100 Pin TQFP
dsPIC33FJ256GP710
PIC24FJ128GA010
SDA1/RG3
SCK1/INT0/RF6
SDI1/RF7
SDO1/RF8
U1RX/RF2
U1TX/RF3
CS 1
SO 2
WP 3
Vss 4
Vcc
8 Vcc
7 HOLD
6 SCK
5 SI
Note: CS, WP and HOLD pins should all have pull-up resistors (~10k-ohms).
© 2007 Microchip Technology Inc.
DS01096B-page 1



No Preview Available !

AN1096
FIRMWARE DESCRIPTION
The purpose of the program is to show individual
features of the SPI protocol and give code samples of
the instructions and addressing schemes so that the
basic building blocks of a program can be shown. The
firmware performs the following operations:
• Low-Density Byte Write
• Low-Density Byte Read
• Low-Density Page Write
• Low-Density Sequential Read
• Write Enable
• WIP Polling
In addition, the following operations are available but
not explicitly illustrated:
• High-Density Byte Write
• High-Density Byte Read
• High-Density Page Write
• High-Density Sequential Read
• Write Disable
• Read Status Register
• Write Status Register
The low-density routines are intended for use with the
4K and smaller density devices that use only one byte
for addressing. The high-density routines are intended
for use with 8K and higher density devices that use two
bytes for addressing. This program also exhibits the
WIP polling feature for detecting the completion of write
cycles after the byte write and page write operations.
Read operations are located directly after each write
operation, thus allowing for verification that the data
was properly written. No method of displaying the input
data is provided, but a SEEVAL® 32 evaluation system,
an oscilloscope, or a Microchip MPLAB® ICD 2 could
be used.
The low-density code was tested using the
25LC040A serial EEPROM. This device features 512
x 8 (4 Kbit) of memory and 16-byte pages. The high-
density code was tested using the 25LC256 serial
EEPROM. This device features 32K x 8 (256 Kbit) of
memory and 64-byte pages. Only the low-density
operations are illustrated in this application note.
Oscilloscope screen shots are labeled for ease in read-
ing. The data sheet versions of the waveforms are
shown below the oscilloscope screen shots. All timings
are designed to meet the data sheet specs, and an 8
MHz crystal oscillator is used to clock the dsPIC33F
DSC or PIC24F microcontroller. If a different clock is
used, the code may need to be modified to avoid violat-
ing timing specs. All values represented in this applica-
tion note are decimal values unless otherwise noted.
DS01096B-page 2
© 2007 Microchip Technology Inc.



No Preview Available !

WRITE ENABLE
Figure 2 shows an example of the Write Enable
command. Chip Select is brought low (active) and the
opcode (0x06) is shifted out. The Write Enable com-
mand must be given in order to set the WEL bit before
FIGURE 2:
WRITE ENABLE (WREN)
AN1096
a write is attempted to either the array or the STATUS
register. The WEL bit can be cleared by issuing a Write
Disable command (WRDI) and is also automatically
reset if the device is powered down or if a write cycle is
completed.
CS
SCK
01234567
SI 0 0 0 0 0 1 1 0
High-Impedance
SO
© 2007 Microchip Technology Inc.
DS01096B-page 3



No Preview Available !

AN1096
READ STATUS REGISTER TO CHECK
FOR WEL BIT
Figure 3 shows an example of the Read Status
Register command to check for the WEL bit. This bit
must be set before a write is attempted to either the
STATUS register or the array. It is good programming
practice to check for the bit to be set before attempting
the write. Once again the device is selected and the
opcode (0x05) is sent.
The STATUS register is shifted out on the Serial Out
pin. A value of 0x02 shows that the WEL bit in the
STATUS register has been set. The device is now
ready to do a write to either the STATUS register or the
array.
FIGURE 3:
READ STATUS REGISTER TO CHECK FOR WEL BIT (RDSR)
CS
SCK
SI
SO
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Instruction
0 00 00 1 01
High-Impedance
Data from STATUS register
7 6 54 3 2 10
DS01096B-page 4
© 2007 Microchip Technology Inc.




AN1096 datasheet pdf
Download PDF
AN1096 pdf
View PDF for Mobile


Similiar Datasheets : AN100 AN1001 AN1003 AN1007 AN101 AN1013 AN10145 AN1025 AN103 AN1034 AN1042 AN1042D AN1043 AN1048 AN1048D AN105 AN10808 AN1082 AN10861 AN10868 AN10935 AN1096 AN10981 AN10E40

Index :   0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z   

This is a individually operated, non profit site. If this site is good enough to show, please introduce this site to others.
Since 2010   ::   HOME   ::   Privacy Policy + Contact