Ethernet 1/7
INTRODUCTION
The purpose of these articles is to realize an Ethernet interface for the PIC microcontrollers, using the Microchip ENC28J60 controller.
Software
The Microchip software includes lots of interesting characteristics, but has some limitations and it isn't simple to use.
The Microelettronica realized a little library for the controller use (can be found with the mikroC compiler), but not supporting the packets fragmentation (it can't be possible to modify it), it doesn't suit to realize a HTTP server and any application which foresees a change gave enough consistent (the limit is 1.4KB).
Realize an own stack is a good mode to know the mechanisms which permit the network functioning, but especially makes easier the protocols implementation and the functionality not predicted in another stack.
Hardware
It will be illustrate the necessary hardware to the controller functioning and we'll see which are the functions and we can configure the ENC28J60.
The ISO/OSI model
The OSI (Open System Interconnection) model was created in 1978 by ISO (International Organization Standardization) to create a standard for the communications between the computers.
It is constituted from a stack with 7 levels (5 in the simplify version); at each level corresponds a protocol, for the way two levels from the different systems can communicate; this happen virtually in a direct mode ignoring the others levels.
Inside the same system, each level can communicate just with the adjacent levels through an interface.

The simplify model levels
- Level 1: physical transmits the dates in the physical way (cable, air, optic fiber, etc.)
- Level 2: Datalink. Prepares the dates to be send to the physical way.
- Level 3: Net. It is useful to "
- Level 4: Transport. Guarantees the right reception of the dates, retransmits the dates in case of errors and permits to establish the connexions.
- Level 5: Application. It is the last level of the stack and as the name suggests it is where are the different services (HTTP, FTP, E-mail, etc.).
Encapsulation
In a net packet, the dates of the different levels are encapsulated one in another, as in a matriosca.
That it means:
- in the transmission phase each level sends the own dates to the inferior level which adds the own encapsulation (and queue) and then at its turn send it to the underneath level until reaches the physical way;
- in the reception phase each level examines the own encapsulation and gives the dates to the superior level

Notice that the communication doesn't concern necessarily the last level, but it's happen always between two equals levels.
This modulation permits, for example, to transport the same dates on the different physicals supports: you just need to think at the Ethernet and WiFi which both transport the TCP/IP packets, but on the different ways (cable and air).
Read also:
Ethernet 2/7
Ethernet 3/7
- Chris's blog
- Add new comment
- 4124 reads





ENC28J60 vs PIC18F97J60
I once did a didactic project using the ENC28J60. However, if I were to do it again, I would go for the PIC18F97J60 micro family, as this is a one chip solution. It means less PCB space and I am also positive everything would be faster. With the ENC chip you have to tediously read everything through SPI, which even if faster, requires a whole new software layer just for that. I found it tiring from a software point of view.
All the best,
Cristian
What about the Silicon Labs CP220 Ethernet Controller?
The Microchip ENC28J60 is a very good and well known controller and it was also the smallest Ethernet controller available on the market.
What about the Silicon Labs CP220 Ethernet Controller?
Does anyone know it or has worked with it?
Reference: https://www.silabs.com/products/interface/ethernetcontrollers/Pages/default.aspx