Using C30 Compiler and The Spi Module To Interface Eeproms With Dspic33F and Pic24F
Using C30 Compiler and The Spi Module To Interface Eeproms With Dspic33F and Pic24F
The 25XXX series serial EEPROMs from Microchip Figure 1 describes the hardware schematic for the
Technology are SPI compatible and have maximum interface between Microchip’s 25XXX series devices
clock frequencies ranging from 3 MHz to 20 MHz. The and the dsPIC33F DSC or the PIC24F MCU. The
SPI module available on dsPIC33F Digital Signal schematic shows the connections necessary between
Controller and PIC24F microcontroller provide a very either controller and the serial EEPROM as tested, and
easy-to-use interface for communicating with the the software was written assuming these connections.
25XXX series devices. The largest benefit of using the The WP pin is tied to VCC because the STATUS regis-
SPI module is that the signal timings are handled ter write-protect feature is not used in the examples
through hardware rather than software. This allows the provided.
firmware to continue executing while communication is
handled in the background. This also means that an
understanding of the timing specifications associated
with the SPI protocol is not required in order to use the
25XXX series devices in designs.
VCC
SDA1/RG3
SCK1/INT0/RF6
100 Pin TQFP SDI1/RF7
SDO1/RF8
dsPIC33FJ256GP710 U1RX/RF2 CS 1 8 VCC
PIC24FJ128GA010 U1TX/RF3
25XXX
SO 2 7 HOLD
WP
VDD
VSS
IC7/U1CTS/CN20/RD14
U2RX/CN17/RF4
IC8/U1RTS/CN21/RD15
U2TX/CN18/RF5
3 6 SCK
VSS 4 5 SI
Note: CS, WP and HOLD pins should all have pull-up resistors (~10k-ohms).
CS
0 1 2 3 4 5 6 7
SCK
SI 0 0 0 0 0 1 1 0
High-Impedance
SO
CS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
SCK
Instruction
SI 0 0 0 0 0 1 0 1
CS
Twc
0 1 2 3 4 5 6 7 8 9 10 11 21 22 23 24 25 26 27 28 29 30 31
SCK
Instruction 16-bit Address Data Byte
SI 0 0 0 0 0 0 1 0 15 14 13 12 2 1 0 7 6 5 4 3 2 1 0
High-Impedance
SO
CS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
SCK
Instruction
SI 0 0 0 0 0 1 0 1
FIGURE 6: DATA POLLING FINISHED (RDSR – WIP AND WEL BITS CLEARED)
CS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
SCK
Instruction
SI 0 0 0 0 0 1 0 1
CS
0 1 2 3 4 5 6 7 8 9 10 11 21 22 23 24 25 26 27 28 29 30 31
SCK
Data Out
High-Impedance
SO 7 6 5 4 3 2 1 0
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
10/05/07