Written by Holguer Andres

 

W5100 Qsys Component.

 

This Qsys component has been designed to be used with the chip Wiznet W5100 alongside the soft-core Nios II.

This manual will tell you how to implement it using the DE0-NANO, and C5GX, and is divided into two parts:

  1. Hardware Part.
    1. Quartus Project.
    2. Qsys.
    3. PINOUT Connections.
  2. Software Implementation.
    1. WebServer Example.

Requirements

Procedure:

Hardware Part

  1. Quartus Project.

    1. To start with this part, we will help you by generating a template system for the DE0-NANO, which can be downloaded it form here.
    2. Decompress and open the Quartus project template.
    3. You will see an instantiation which is a basic qsys system that you are going to modify in order to get the W5100 working properly.

  2. Qsys. 
    1. Download the following folder, and paste it on the project directory.
    2. Click on the Qsys Button , and open the file "DE0_NANO_QSYS.qsys".
    3. Then you will see a basic system Nios II structure with all the basic components to start with
    4. Now, go to the menu "Tools->Options", and add to the "IP Search Path" the ip folder you just copied to the project directory.
    5. Now save the Qsys project, close it and reopen it.
    6. On qsys, search on the IP catalog the component "Wiznet 5100" under "Interface Protocols->Ethernet", select and add it to the qsys project.



    7. Now connect the Wiznet 5100 module as follows:
    8. Now save the Qsys project.
    9. Go to the menu "Generate->HDL Example", and you should see something like this
    10. Select and copy only the lines with the name of "ethernet_wiznet_5100_0".
    11. Go back to Quartus without closing the Qsys project, and paste the copied code on the line 148.


    12. Go back to the Qsys system, and generate the Qsys system by pressing the button "Generate HDL".
    13. Once generated, close Qsys.

  3. PINOUT Connections.

    1. Now it is time to connect the W5100 module to the GPIOs of the DE0-NANO, for that, I have decided to connect the Wiznet pins to the following GPIOs:

      it is important to highlight that depending on the board you are using, you should check on the board Pinout, which might vary depending on the manufacture.

      For the Mini board:


      For the Arduino Etherner Shiled:
      ethernet_pins.jpg

      Here the DE0-NANO PinOut:
    2. Connect the GPIOs on the Verilog Instantiation.
    3. Save.
    4. Compile the project.
    5. Well done you have now finished with the Hardware part!!!.
    6. Here the Hardware Solution just in case you might have missed a detail.

Software Implementation

  1. WebServer Example.
    1. Open the Nios II IDE as admin
    2. Select as a workspace just the name "fpgas"


    3. Once the IDE is opened, go to the menu "File->New->New Application and BSP from template", select the template "Hello MicroC/OS-II", select the target hardware information using the file "DE0_NANO_QSYS.sopcinfo", name the project with "Wiznet5100", and press finish.
    4. After this, two folder will be created "Wiznet5100", and "Wiznet5100_bps"
    5. To verify that the created project was created properly compile the project application by right-clicking on the folder "Wiznet5100" Build Project.
    6. if the project was created properly, you will see that an ELF file with a bug is created into the "Wiznet5100" folder.

    7. Now, download the folder "winzet", and paste it into the "Wiznet5100" folder, which contains the W5100 Drivers.
    8. Right-click on the Wiznet5100 folder, and clean the project.
    9. Now it is time to edit the code of the hello_ucosii.c file. and replace it for the following.
    10. // --------------------------------------------------------------------
      // Copyright (c) 2017 by FPGALOVER
      // --------------------------------------------------------------------
      //                     web: http://www.fpgalover.com
      //                     email: This email address is being protected from spambots. You need JavaScript enabled to view it. or This email address is being protected from spambots. You need JavaScript enabled to view it.
      // --------------------------------------------------------------------
      //	Author: Holguer Andres Becerra Daza
      //  Description: SW example
      // --------------------------------------------------------------------
      // **************************************************************************/
      
      #include <stdio.h>
      #include "includes.h"
      
      #include "wiznet/W5100_configs.h"
      
      /* Definition of Task Stacks */
      #define   TASK_STACKSIZE       2048
      OS_STK task1_stk[TASK_STACKSIZE];
      OS_STK task2_stk[TASK_STACKSIZE];
      
      /* Definition of Task Priorities */
      
      #define TASK1_PRIORITY      1
      #define TASK2_PRIORITY      2
      
      
      void http_server(void* pdata);
      void init_hw();
      
      void init_hw() {
      	if (!reset_wiznet()) {
      		printf("-- Wiznet-Ethernet Fail(SPI)\n");
      	} else {
      		printf("-- Wiznet-Ethernet SPI Succeeded\n");
      	}
      }
      
      //HTTP Server example
      void http_server(void* pdata) {
      	init_hw();
      
      	if (init_dhcpc_ch(_DHCP_SOCKET) == 0) {
      		printf("IP STATIC or DHCP not Working, check Flags...\n");
      	}else{
      
      	}
      
      	HTTP_Init(HTTP_SOCKET, HTTP_PORT);
      	while (1) {
      		HTTP_Server_example();
      		OSTimeDlyHMSM(0, 0, 0, 100);
      	}
      }
      
      /* The main function creates two task and starts multi-tasking */
      int main(void) {
      
      	OSTaskCreateExt(http_server,
      	NULL, (void *) &task1_stk[TASK_STACKSIZE - 1],
      	TASK1_PRIORITY,
      	TASK1_PRIORITY, task1_stk,
      	TASK_STACKSIZE,
      	NULL, 0);
      
      	OSStart();
      }
      ​
    11. Now you can pore through the code and explore it, look especially into the method "HTTP_Server_example()", which contains all the logic about the web sever. In addition, you can take a look into the "wiznet" folder, especially the file "W5100_configs.h" which contains all the Wiznet w5100 driver configurations.
    12. Build the software project.
    13. Program the .SOF of the system using the Quartus Programmer, and run the generated .elf File.
      Note: The Wiznet module should be properly connected to the DE0-NANO, and plugged to the Ethernet cable for the testing.
    14. Now you will see on the Nios II console a message telling whether or not the wiznet module has been successfully initialized, if so, you will see an assigned IP by the DHCP, which you can use and paste it on the web navigator of your preference to see the web page working, as it is seen in the following images.



    15. Finally and for you relief I have left the solution on the following link so that you can try it if you have any problem testing, in addition the solution comes with a Python Script and a TCP example solution for you to try it.

 The sources for the C5GX board using the arduino Header has been uploaded as well and can be downloaded from here.

 

 

 

 

Attachments:
Download this file (C5GX_W5100_solution.zip)C5GX_W5100_solution.zip[ ]2213 kB
Download this file (DE0_NANO_W5100_hw.zip)DE0_NANO_W5100_hw.zip[ ]1203 kB
Download this file (DE0_NANO_W5100_solution.zip)DE0_NANO_W5100_solution.zip[ ]2662 kB
Download this file (DE0_NANO_W5100_template.zip)DE0_NANO_W5100_template.zip[ ]171 kB
Download this file (ip.zip)ip.zip[ ]32 kB
Download this file (wiznet.zip)wiznet.zip[ ]29 kB
Powered by OrdaSoft!
  Written By Peter Gomez Este contenido esta orientado a los programadores que tienen problema con la conectividad("SGC PmmC") de su pantalla uOled-128-g1/g2…
Written by Sherneyko Plata Rangel   Pynq-z2: Hello world   In this tutorial we will implement a simple test of the inputs/outputs available on…
Objetivos Requerimientos Procedimiento Descripción de Hardware. Qsys. Nios II. UCOS II. Secuencia de Sprite. Sintesis de Audio. Descargas Glosario Otros Resultados. Ejemplo de Sprites.     Objetivos: Diseñar una plantilla general para el diseño de…
Written by Holguer A. Becerra           Requerimientos: DE0-NANO USB-UART(solo para parte 3) Python 2.7 ó superior.   Objetivos: Dar una introducción a los conceptos de Multitasking, Scheduling y…
Written by Holguer A. Becerra             Based on Gregory Estrade's Work.   I have ported the PC Engine System on the DE0-NANO back in 2014, why…
      Arduino tools are generally nice tools for quick prototyping and improvized projects, and the Seeeduino Xiao…
Written by: Holguer A Becerra         En esta practica vamos a construir nuestro primer juego retro  usando un sincronizador de Video VGA…
Written by: Andrea Paola Pabón Ortega & Daniel Enrique Mejia Rueda Revision by: Ing Holguer A. Becerra   DESCRIPCIÓN DEL PROYECTO: El  RTAWD DE0NANO…
  Written by Holguer Andres   Requires: DE0-NANO. 4.3 Inch 480x272 Screen.( WQVGA ) ?️       Parte HW: Descargue la siguiente plantilla( DE0_NANO_TFT_PSP.zip) y descomprimala en una ruta sin espacios y…
Escrito por Guillermo Acevedo   Diseño   En esta practica desarrollaremos un filtro FIR en hardware, para este caso en especifico, realizaremos un filtro…
 Written By Juan David Delgado   FILTRO FIR (FILTRO DE RESPUESTA FINITA AL IMPULSO)     Son conocidos como filtros digitales no recursivos debido a…
XISCKER: Reduced and Complex Instruction Set Computing Key Educational Resources A Configurable Platform for the Emulation of Different Computer Architectures An introduction to Computer Architectures through digital design description for FPGA devices   Computer Architecture embraces all three…
Escrito por: Alix Angarita   En el manual a continuación se explica un método de debug adicional que es muy interesante debido a…
By: Fabio Hernández   INTRODUCCIÓN:   El presente documento pretende mostrar la manera de generar software para una imagen de Linux implementada en la…
Summary Written by Fabio Hernandez   HARD PROCESSOR SYSTEM (HPS)     ------------------------------------------------------------------------------------------------------------------------------------------------   Introducción   Tenemos  2 nuclos de procesamiento ARM cortex-A9, cada uno son su propio cache  se…
Escrito por Jesus Lopez         INTRODUCCIÓN   El acceso directo a memoria (DMA, del inglés direct memory access) permite a cierto tipo de componentes de una computadora acceder a…
    Written by  Sebastian Baquero       Objetivos  Introducción a los conceptos de Multitasking, Scheduling y Context Switching.  Ampliación de los conceptos a cerca de el…