Mikroelektronika MIKROE-738 Datenbogen
mikroC PRO for PIC32
MikroElektronika
441
SPI Ethernet Library
The
ENC28J60
is a stand-alone Ethernet controller with an industry standard Serial Peripheral Interface (SPI). It is
designed to serve as an Ethernet network interface for any controller equipped with SPI.
The
ENC28J60
meets all of the IEEE 802.3 specifications. It incorporates a number of packet filtering schemes to limit
incoming packets. It also provides an internal DMA module for fast data throughput and hardware assisted IP checksum
calculations. Communication with the host controller is implemented via two interrupt pins and the SPI, with data rates
of up to 10 Mb/s. Two dedicated pins are used for LED link and network activity indication.
This library is designed to simplify handling of the underlying hardware (
ENC28J60
). It works with any PIC32 with
integrated SPI and more than 4 Kb ROM memory. 38 to 40 MHz clock is recommended to get from 8 to 10 Mhz SPI
clock, otherwise PIC32 should be clocked by ENC28J60 clock output due to its silicon bug in SPI hardware. If you try
lower PIC32 clock speed, there might be board hang or miss some requests.
SPI Ethernet library supports:
- IPv4 protocol.
- ARP requests.
- ICMP echo requests.
- UDP requests.
- TCP requests (no stack, no packet reconstruction).
- ARP client with cache.
- DNS client.
- UDP client.
- DHCP client.
- packet fragmentation is
NOT supported.
Important:
- Global library variable
SPI_Ethernet_userTimerSec
is used to keep track of time for all client implementations
(ARP, DNS, UDP and DHCP). It is user responsibility to increment this variable each second in it’s code if any of the
clients is used.
- For advanced users there are header files (
“eth_enc28j60LibDef.h”
and
“eth_enc28j60LibPrivate.h”
)
in Uses folder of the compiler with description of all routines and global variables, relevant to the user, implemented in
the SPI Ethernet Library.
- The appropriate hardware SPI module must be initialized before using any of the SPI Ethernet library routines. Refer
to SPI Library.
- For MCUs with multiple SPI modules it is possible to initialize them and then switch by using the
SPI_Set_Active()
routine.
Library Dependency Tree