Mikroelektronika MIKROE-724 データシート
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
475
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 dsPIC30/33
and PIC24 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 dsPIC30/33 and PIC24 should be clocked by
ENC28J60
clock output due to its silicon
bug in SPI hardware. If you try lower dsPIC30/33 and PIC24 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 is
__EthEnc28j60Private.mbas
unit 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