Mikroelektronika MIKROE-442 Datenbogen
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
503
SPI_Ethernet_24j600_Init
Prototype
sub procedure SPI_Ethernet_24j600_Init(dim mac as ^byte, dim ip as ^byte,
dim fullDuplex as byte)
Description This is MAC module routine. It initializes
ENC24J600
controller. This function is internally 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 filters set to default: CRC + MAC Unicast + MAC Broadcast in OR mode.
- flow 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 configuration: default (LEDA-link status, LEDB-link activity).
Parameters -
mac
: RAM buffer containing valid MAC address.
-
ip
: RAM buffer containing valid IP address.
-
configuration
: ethernet negotiation, duplex and speed mode settings. For this purpose, predefined
library constants (see the list below) can be combined using logical AND to form appropriate value:
Description:
Predefined 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.