Professional Documents
Culture Documents
25-spi-ethernet_interfacing_with_arm7_slicker
25-spi-ethernet_interfacing_with_arm7_slicker
Interfacing SPI-
Ethernet with LPC2148
Contents at a Glance
ARM7 LPC2148 Slicker Board ...........................................3
SPI (Serial Peripheral Interface)........................................3
Ethernet ..........................................................................4
The ENC28J60 Ethernet Controller ...................................4
Interfacing SPI-Ethernet ...................................................5
Interfacing SPI-Ethernet with LPC2148 .............................7
Pin Assignment with LPC2148 ..........................................7
Circuit Diagram to Interface SPI-Ethernet with LPC2148 ...8
Source Code ....................................................................8
C Program to interface Ethernet with LPC2148 .................9
Testing the SPI-Ethernet with LPC2148 ........................... 16
General Information ...................................................... 17
SCK
ISP PGM
MOSI P0.5
MISO P0.6
UART1
(P2)
CS P0.7
+5V
3.3V
+5V
C20
D12 D13 J10 0.1uF U23
20
LED LED +3.3V
63
51
43
23
7
U16 2 18
VCC
1 2 ETH_3.3V 3 A0 B0 17
VDD1
VDD2
VDD3
VDDA
VREF
C19 A1 A2 3 4 4 A1 B1 16 INT*_ETH
R49 1K ETH_INT
6 10UF 5 6 5 A2 B2 15 WOL*_ETH
11
22
21
18
ETH_WOL
2
18 VSS1 U18 R50 R56 7 8 6 A3 B3 14 MISO_ETH
25 VSS2 1 330E 330E R58 100E 7 A4 B4 13
R52 1K
VSS
VSSRX
VSSPLL
VSSTX
VSSOSC
42 VSS3 14 VCAP MISO 8 A5 B5 12
+5V
50 VSS4 RBIAS 27 9 A6 B6 11
59 VSS5 3 LEDA 26 C21 22pf HEADER 4X2 A7 B7
VSSA 41 INT*_ETH 4 CLKOUT LEDB R61 1
GND
LPC2148 P0.14 45 WOL*_ETH 5 /I/N/T 24 10K 19 DIR
P0.15 /WO/O/L OSC2
25MHz
30 MISO_ETH 6 23 Y2 G
P0.6 29 R55 100E 7 SO OSC1
10
P0.5 27 R57 100E 8 SI ENC28J60 28 74LS245
P0.4 38 9 SCK VDD 25 ETH_CS
C22 22pf
P0.12 39 10 /C/S VDDOSC 20
TPOUT+
P0.13 RESET VDDPLL
TPOUT-
19
XTAL2
XTAL1
RD- 12 VDDRX 15
RD+ 13 TPIN- VDDTX
TPIN+ ETH_3.3V
61
62
16
17
12MHz ETH_3.3V
TD+
TD-
A2
L2
22pf 22pf F-BEAD
TD+
11
12
U21
1
K2
A2
R53 56E 4 TD+
2 CT
TD- RJ45
3 8
R54 56E 5 RD+ GND
TD-
6 CT
A1
K1
RD+ RD-
9
10
R59 56E
C23
0.1uF
A1
R60 56E
RD-
C24
0.1uF
Source Code
***************************************************************************************
Title : Program to control LED & Switches from Ethernet using SPI
***************************************************************************************
#include <LPC214X.H>
#include "string.h"
#include "ENC28J60.h"
#include "c_ctype.h"
#include "conv.h"
#include "Utility.h"
#define ENC28J60_HALFDUPLEX 0
#define ENC28J60_FULLDUPLEX 1
while (1)
{
ENC28J60_doPacket(); // incoming Ethernet packets
/*
* add your stuff here if needed
* ENC28J60_doPacket() must be called as often as possible
* otherwise packets could be lost
*/
}
}
ctr = 0;
while(*s)
{
ENC28J60_putByte(*s++);
ctr++;
}
return(ctr);
}
ctr = 0;
while(*s)
{
ENC28J60_putByte(*s++);
ctr++;
}
return(ctr);
}
len = 0;
bitMask = 0;
if (localPort != 80)
return(0) ;
if (getRequest[5] == 's')
{
len = putConstString(httpHeader); // HTTP header
len += putConstString(httpMimeTypeScript);
IntToStr(0, dyna);
len += putConstString("var AN0=");
len += putString(dyna);
len += putConstString(";");
return (len);
}
Now you can control the input & output port lines (LED
& switch) of LPC2148 Slicker Board from Internet Explorer
General Information