Professional Documents
Culture Documents
Introduction ........................................................................................................................................................ 3
Package contents ................................................................................................................................................. 5
Description .......................................................................................................................................................... 6
Ethernet Interface Board .............................................................................................................................................. 6
Ethernet buffer ............................................................................................................................................................. 7
Features .............................................................................................................................................................. 8
Ethernet Controller Features ........................................................................................................................................ 8
Buffer ............................................................................................................................................................................ 8
Medium Access Controller (MAC) Features .................................................................................................................. 9
Physical Layer (PHY) Features ....................................................................................................................................... 9
How To Set Up The Connection .......................................................................................................................... 10
Configurations ................................................................................................................................................... 11
Connecting uNiBoard directly to the PC ..................................................................................................................... 12
Connecting uNiBoard directly on to the Network ...................................................................................................... 12
How Ethernet Interface Board Works?................................................................................................................ 13
Reception .................................................................................................................................................................... 13
Transmission ............................................................................................................................................................... 14
Wireshark .......................................................................................................................................................... 15
Application Note ................................................................................................................................................ 18
uIP…............................................................................................................................................................................. 18
Embedded Webserver ................................................................................................................................................ 19
Appendix A – References.................................................................................................................................... 22
Appendix B - Services and Support ..................................................................................................................... 23
Introduction
Ethernet is a local area technology, which is used for reliable and efficient transfer and access
of information across the devices connected to the network. Once a device is attached to the
network, it will have the ability to communicate with any other attached device. This allows
the network to expand to accommodate new devices without requiring any modification to
those devices already on the network.
In case of embedded applications, the lightweight protocols like SPI, I2C and UART would not
add the capability of controlling your standalone device from any remote place. That is when
the need for adding an Ethernet interface to your embedded device is felt. To facilitate this
need you would need some additional hardware which would include an Ethernet PHY and a
networking protocol stack.
Ethernet controller ENC28J60 from Microchip forms the building block for our Ethernet
Interface add-on Board. It’s an SPI based add-on chip which has Ethernet PHY and MAC to
equip any embedded controller with SPI interface with network capability. Through this
interface our controller can communicate with other devices connected on the network
including PCs.
NOTE: Throughout the user manual instead of development board the term uNiBoard is used,
but any development board using a controller with SPI (Serial Peripheral Interface) interface
can be interconnected with Ethernet Interface Board.
uNiBoard v1.1 is an open source development board for Embedded and Real Time Systems
programming. The uNiBoard project is hosted on this link: http://code.google.com/p/uniboard
and more details about the board can be obtained in that link.
Package contents
Description
Ethernet Interface Board v1.0: It contains the Ethernet Controller ENC28J60 with SPI
support and Ethernet Jack – MAG Jack (RJ45).
The Ethernet Interface Board v1.0 helps to connect a particular embedded device to the
network. If a particular embedded device is connected to the network, command or data for
that particular embedded device can be provided from any of the devices connected to that
network.
The Ethernet Interface Board can be connected to the uNiBoard (which will be the heart of
that particular device) and by using SPI pins of the Ethernet controller (ENC28J60) the
Ethernet Interface Board communicates with the uNiBoard. This Ethernet Interface can be
used to develop different applications like embedded web server, Ethernet based Data
acquisition system, internet controlled robot (Telepresence robot) etc.
If your embedded device is a robot and you want to control that from a remote place you just
need a PC which is connected to the network. From the PC you can send commands to the
robot though your Ethernet network.
Ethernet buffer: It is the memory area inside ENC28J60 and it contains transmit and
receive memory used by the Ethernet controller in a single memory space, means receive and
transmit share the same buffer (memory). The sizes of the memory areas are programmable
by the host controller using the SPI interface. It is of 8-Kbyte transmit/receive packet dual port
SRAM. The Ethernet buffer memory can only be accessed via the read buffer memory and
write buffer memory SPI commands.
In ENC28J60 Network Interface(Link) Layer is present, that means Physical layer + MAC layer
(comes inside Link layer), with this we can achieve physical connection and link detection. For
application layer protocols like FTP, HTTP etc. TCP/IP stack should be ported to the embedded
device.
Features
Buffer
• Loopback mode
• Loopback mode
Connect the pins of the Ethernet Interface board with the Development Board (uNiBoard)
accordingly (refer figure).
CS <-> SS
Load the sample program given on the CD to uNiBoard. Connect the network cable between
Ethernet Interface Board and PC. Power on the uNiBoard and if the link is up between Ethernet
Interface Board and PC, the LED on the RJ45 will start to blink, which means that the physical
layer is up and working.
RESET signal
The Ethernet Interface Board can be powered from the Development Board (uNiBoard) or can
be given an external 3.3v supply.
Configurations
There are two different configurations that you can have with the board as shown below of which the
first configuration can be used for testing and development purposes while the second one would be
used for application purposes.
Ethernet
uNiBoard v1.1 Interface Board PC
Fig: Connection between the uNiBoard and Ethernet Interface Board is done as described
above and PC is interfaced with the Ethernet Interface Board using the network cable.
Ethernet Interface
uNiBoard v1.1 Board
Network
PC
Fig: Connection between the uNiBoard and Ethernet Interface Board is done as described
above and Ethernet Interface Board is connected to the network directly. Run Wireshark
(procedure described below) on any of the PCs connected to that network.
Make the connections between uNiBoard (development board), Ethernet Interface board and
PC as described above. So the data transfer between the ENC28J60 and the uNiBoard will be
carried out through the SPI interface. Whatever data is transmitted or received through the
Ethernet Interface Board will be stored in the Ethernet Buffer in the ENC28J60.
Reception: Data coming from the network through the cable will be stored in the Ethernet
Buffer, this will be done by the firmware written on the ENC28J60. From the Ethernet Buffer
we can read the data through the SPI pins of the ENC28J60 to the uNiBoard.
PacketReceive function would be called first and in that Write function will take the value and
address to which the write operation to be performed. SetBank will set the address bank and
the WriteOp will actually do the write. These two function calls are done within Write function
as can be seen above. In ReadOp we will provide address of the buffer as argument and it will
return with buffer values, so using this function the actual read is done from the buffer.
Using these API's all the data in the Ethernet Buffer can be read through the SPI pins.
Transmission: For sending the data packets through the interface, the data should be
written on Ethernet Buffer which is done by using the SPI. Then that data will be transmitted
from the buffer through the network cable to the network, which is done by the firmware
written on the ENC28J60 controller.
PacketSend function will be called first and in that Write function will take the value and
address to which the write operation to be performed. SetBank will set the address bank and
the WriteOp will actually do the write. These two function calls are invoked in Write function.
WriteBuffer will write the data to be sent into the buffer.
Using these API's the data needs to be sent to the Ethernet Interface Board where it will be
stored to the Ethernet Buffer, and from there it will be sent through the cable.
Wireshark
Fig1: Shows how the application looks like (After running the Wireshark application this
window will be opened.)
Fig 2: Shows how to select the capturing interface (Select capture menu and select interfaces.)
Fig 3: Shows which device should be selected (Click the start button associated with your
network adaptor (Ethernet).
• Connect the Ethernet Interface Board to the system where Wireshark is running (using the
network cable), also connect Ethernet interface board and the Development Board
(uNiBoard) as described in the earlier section.
• Whenever a link is up that corresponding Network or PC will start sending an ARP request
first to the board through Ethernet interface and in reply an ARP and an IP packet is sent
from the board and received which is shown in the above figure as the 3rd and 4th packets.
(These ARP and IP packets are generated by our source code). You can get the details of the
packet by clicking on them and on the lower half details like the target PC's IP address and
sender's IP address etc. are displayed.
Application Note
uIP: Data transfer over the network is achieved through the implementation of TCP/IP
application layer. Porting TCP/IP stack on to our board is needed for the data transfer (using
protocols like FTP (file transfer protocol), HTTP (Hypertext Transfer protocol). These are all
implemented in TCP/IP application layer. Due to memory constraints we port uIP (The open-
source uIP TCP/IP by Mr. Adam Dunkels stack provides TCP/IP connectivity to tiny embedded 8-
bit microcontrollers) on to our board, which is a small and simple.
The uIP TCP/IP stack is intended to make it possible to communicate using the TCP/IP protocol
suite even on small 8-bit micro-controllers. Despite being small and simple, uIP does not
require their peers to have complex, full-size stacks, but can communicate with peers running
a similar light-weight stack. The code size is of the order of a few kilobytes and RAM usage can
be configured to be as low as a few hundred bytes.
A high-performance Embedded Web server allows users to monitor and control their
embedded applications using any standard browser. By using an embedded Web server,
developers can format and display the data in any standard browser. The user’s response to
the data can include input to modify the embedded device’s configuration.
Moreover, communication with the embedded application can use Ethernet or fast serial
connections. In addition, you can use any of the TCP/IP application layer protocol to handle the
transfer of larger amounts of data to any device on the same network. Protocols like FTP (file
transfer protocol), HTTP (hyper text transfer protocol) helps to transfer data through the
network, and these protocols are implemented in the TCP/IP application layer.
Fig: uNiBoard
uNiBoard v1.1 can be used as the embedded device controller since Atmega128 port for uIP
exists(http://www.sics.se/~adam/uip/index.php/Main_Page) and this Ethernet Interface Board
can be used to implement an embedded web server.
The following is an example of how Embedded Web Server works; it shows how to control the
room temperature in different conditions from a different location. The details from the
Embedded Web Server can be received using the Ethernet Interface and it will be shown in a
GUI, from the details received corresponding actions can be taken.
Fig: Shows how the user interface in the system should look like
Appendix A – References
www.microchip.com
www.microchip.com/downloads/en/DeviceDoc/39662b.pdf
http://www.sics.se/~adam/uip/index.php/Main_Page
http://www.avrfreaks.net/
www.thinklabs.in/forums
www.thinklabs.in/resources
www.thinklabs.in/roboshop
http://code.google.com/p/uniboard/