Project Description

WIZnet’s chip solution includes Hardware TCP/IP stack (we are saying it TCP/IP Offload engine). Can we use WIZnet chip on the platform where software TCP/IP stack already operates such as Linux.? Yes, we can. There are 3 ways

#1 : Use the MACRAW mode. In this mode, WIZnet chip operates as normal MAC/PHY chip.

#2 : Replace the software TCP/IP with Hardware TCP/IP engine of WIZnet chip (Disable the software TCP/IP engine)

#3 : Mixing #1 & #2. We are saying it hybrid mode.

In this posting, we will provide the porting guide of W5500 Linux driver using MACRAW mode. We will use the W5300E01-ARM for Linux board and its kernel version is 2.6.24. (W5300E01-ARM is based on the MCU, S3C2410A(200MHz &266MHz -32-Bit RISC)

1. Driver Development Environment

Preparation materials

Install Toolchain

After downloading ‘arm-toolchain-3.4.3.tar.gz’, install it as below.

make directory /usr/local/arm

Install toochain

Setting toochain path:

Verify: type arm and press TAB

Compile Linux kernel

 

2. Hardware Connection

Below is the layout of W5300E01-ARM. We are going to connect it with WIZ550io using J4 connector
hardware
J4 Connector
Connect WIZ550io with SPI0 of J4 Connector

j4connector

The pin connections are as below

Pin Name Pin No Dir WIZ550io
SPICLK0 24 -> SPI Clock
SPIMOSI0 26 -> SPI MOSI
SPIMISOO 28 <- SPI MISO
EINT10 30 RESETn
ENT1 37 -> SPI SELECT

 

※ WIZ550io PinMap

wiz550io_pinmap

 

3. Porting Guide

Hardware Configuration in mach-W5300e-1.c
Set W5500 hardware related configuration in ‘mach-w5300e01.c’, the configuration file that exists in the path ‘
linux/arch/arm/mach-s3c2410/’

  • SPI pin configuration

  • Interrupt Request(IRQ) Pin Connection

  • Reset Pin Configuration

  • Virtual Base Address Configuration

W5500 Linux Driver Porting

  • Enable PCLK into SPI block

  • Control : polling mode / SPI Clock enable / master select / CPOL=0 / etc

  • Baudrate : PCLK / 2 / ((SPPRE0)+1)

  • IRQ

  • Chip Select

  • Default MAC Address

Write the detault MAC address to W5500. You can change the MAC address using ifconfig in kernel.

  • Socket Buffer Size

W5500 supports 8 hardware sockets. As 5500 operates as MACRAW mode, we will allocate 8Kbytes to the socket#0 for TX/RX buffer. (At eh MACRAW mode, only socket#0 is available)

  • SPI READ/WRITE Function

  • Hardware Reset for W5500

4. Testing W5500 Linux Driver

w5300_board

  • Connect the serial port to a PC to check the logs. You can download w5500.ko, the Linux driver module through Zmodem
  • You can download the kernel through the Ethernet port of WIZ830MJ at the Bootloader
  • After kernel is activated, the packet is transferred through Ethernet port of WIZ550io.

Kernel download on target board
Connect the W5300E01-ARM and PC using serial cable. In order to enter the bootloader, input ‘enter’ in the serial terminal in 3 seconds after turning on the power of the board. You can download the kernel to the target board as below.

Driver module download
At the serial terminal, you can download ‘w5500.ko’ through zmodem, and load the module to the kernel.

Ping Test

  • on the Board side

#ping 192.168.0.223 // PC address
ping

 

  • on the PC side

#ping 192.168.0.3 // Target board address
ping_pc

netloop in app
You can use network loopback program included in driver code.

  • Compile

#arm-linux-gcc netloop.c -o netloop

  • Download netloop by using Zmodem

Download the netloop to the target board using Zmodem.

  • netloop options
Option Description
-u UDP loopback mode
-t TCP loopback mode
-p Port Number (Default 5001)
-b Socket Buffer size (Default 2048)
  • Example : TCP loopback: port number 5003, socket buffer size : 4096

$netloop -t -p 5003 -b 4096