User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
469
SPI_Ethernet_24j600_Init
Prototype
void SPI_Ethernet_24j600_Init(unsigned char *mac, unsigned char *ip, unsigned
char fullDuplex);
Description This is MAC module routine. It initializes ENC24J600 controller. This function is internaly splited into 2
parts to help linker when coming short of memory.
ENC24J600 controller settings (parameters not mentioned here are set to default):
- receive buffer start address : 0x0000.
- receive buffer end address : 0x19AD.
- transmit buffer start address: 0x19AE.
- transmit buffer end address : 0x1FFF.
- RAM buffer read/write pointers in auto-increment mode.
- receive lters set to default: CRC + MAC Unicast + MAC Broadcast in OR mode.
- ow control with TX and RX pause frames in full duplex mode.
- frames are padded to 60 bytes + CRC.
- maximum packet size is set to 1518.
- Back-to-Back Inter-Packet Gap: 0x15 in full duplex mode; 0x12 in half duplex mode.
- Non-Back-to-Back Inter-Packet Gap: 0x0012 in full duplex mode; 0x0C12 in half duplex mode.
- Collision window is set to 63 in half duplex mode to accomodate some ENC24J600 revisions silicon bugs.
- CLKOUT output is disabled to reduce EMI generation.
- half duplex loopback disabled.
- LED conguration: default (LEDA-link status, LEDB-link activity).
Parameters - mac: RAM buffer containing valid MAC address.
- ip: RAM buffer containing valid IP address.
- conguration: ethernet negotiation, duplex and speed mode settings. For this purpose, predened
library constants (see the list below) can be combined using logical AND to form appropriate value:
Description Predened library const
Set Auto-negotiation
SPI_Ethernet_24j600_AUTO_NEGOTIATION
Set manual negotiation.
SPI_Ethernet_24j600_MANUAL_NEGOTIATION
Set Half duplex Mode
SPI_Ethernet_24j600_HALFDUPLEX
Set Full duplex Mode
SPI_Ethernet_24j600_FULLDUPLEX
Set transmission speed of 10Mbps
SPI_Ethernet_24j600_SPD10
Set transmission speed of 100Mbps
SPI_Ethernet_24j600_SPD100
Note:
- It is advisable to use only the Auto-negotiation setting. If manual negotiation is used, then duplex and
speed mode setting must be set also.
- Duplex and speed mode may be set only when using manual negotiation.