Transplant environment: Cyclone IV Development Board, NIC chip for enc28j60, browser (firefox_24.0.0.5001a)
First, you need to understand the NIC Chip enc28j60, a Chinese version of the manual: Http://wenku.baidu.com/link?url= 79r8johigayag9kx9-foyirh41jfsyrkxpidaw9xizdpjit5jbh8gjiobjcsiekhym-4tisqnxfd74e2tf1be2wxupuiews0rfrdiw9prks
ENC28J60 is not a standard Ethernet PHY, it uses the SPI protocol and supports only 10Mbps Ethernet speeds. First, build the Nios SOPC system such as:
System Clock 100MHz, the program runs in SDRAM, with ENC28J60 related hardware connection, LAN is actually an SPI, in addition there are lan_cs (chip selection), Lan_nint (Receive interrupt).
The clock is a timer and the timing period is 1ms.
Is the system's BDF schematic connection, the PLL provides the clock, the C0 is the system clock, the C1 is the SDRAM clock (with phase deflection-73 degrees)
After the system compiles, download the corresponding SOF file.
Second, we want to download uIP source code, the address is: Http://www.dunkels.com/adam/uip, now UIP is already part of Thingsqure (Contiki).
The UIP is ported below, and the Web_server program provided by the tester for UIP is in the uIP app folder. ENC28J60 drivers for enc28j60.c and Enc28j60.h
NIOS II mainly modifies these files
TAPDEV.C: Add the NIC driver, don't forget to initialize the MAC address (Tapdev_init function)
Uip-confi.h configuration of the UIP function (Enable # include "Webserver.h")
CLOCK_ARCH.C has a UIP system time function, global variable G_runtime management system time
A timer is opened below to time the g_rumtime.
After compiling the program, run as Nios II hardware
After the program runs, use the Grab Kit tool (Wireshark) Netanalyzer to view the packet.
TCP Three-time handshake, the connection request is as follows:
The program is:
http://download.csdn.net/detail/wangyue2725/7423141