Wiznet makers

WIZnet

Published May 17, 2023 ©

758 UCC

232 VAR

0 Contests

0 Followers

0 Following

Original Link

[FRDM-KL25Z(mbed)]WIZ550io Shield-A Porting Guide

WIZ550io Shield-A is arduino shield for using ethernet more easy.

COMPONENTS Hardware components

WIZnet - WIZ550io

x 1


NXP - FRDM-KL25Z

x 1


PROJECT DESCRIPTION

Original post: http://kaizen8501.blogspot.com/2014/10/frdm-kl25zwiz550io-shield-porting-guide.html

 

WIZ550io Shield-A is arduino shield for using ethernet more easy. FRDM-KL25Z is also compatible with arduino shiled. So If WIZ550io Shield-A attach on FRDM-KL25Z, it can use ethernet easily.
But WIZ550io Shield-A has some problem. If using Arduino Board, it has two method to use spi signal.
First, it can use Digital pin 9 to 12 for SPI communication. ( 9: SCSn, 10: MOSI, 11: MISO, 12: SCLK )
Second method is using ICSP.
But WIZ550io can support only second method for using SPI. So I did need some work for modifying WIZ550io Hardware in order to use digital pin 9 to 12 for SPI communication as below picture. ( I think that it will be changed for solving this problem. )
 
There is WIZ550io picture about attached with FRDM-KL25Z board.
 

Software

WIZ550io(W5500) library already exist in mbed site. If you want download W5500 library, Click it
At this place, I could use example application. In this post, I used webSocket example.
This is source code about webSocket example using FRDM-KL25Z.
#include "mbed.h"
#include "EthernetInterface.h"
#include "Websocket.h"

#define _DHCP
Serial pc(USBTX, USBRX); // tx, rx

int main()
{
    int ret;
    pc.baud(115200);
    pc.printf("Start Applicationrn");

    SPI spi(D11, D12, D13); // mosi, miso, sclk
    EthernetInterface eth(&spi, D10, D9);//scs(D10), nRESET(PTA20)

    wait(1);

#ifdef _DHCP
    eth.init();
    ret = eth.connect();
#else
    ret = eth.init("192.168.11.10","255.255.255.0","192.168.11.1");
#endif

    if(!ret)
    {
        pc.printf("Initialized, MAC: %srn", eth.getMACAddress());
        pc.printf("Connected, IP: %s, MASK: %s, GW: %srn",
               eth.getIPAddress(), eth.getNetworkMask(), eth.getGateway());
    }
    else
    {
        pc.printf("Error eth.init() - ret = %drn",ret);
        return -1;
    }

    Websocket ws("ws://sockets.mbed.org:443/ws/demo/rw");
    ws.connect();

    char str[100];
    for(int i=0; i<0x10; ++i) {
        sprintf(str, "%d WebSocket for WIZnet W5500 Hello World over Ethernet : No Sensor", i);
        ws.send(str);

        // clear the buffer and wait a sec...
        memset(str, 0, 100);
        wait(0.5f);

        // websocket server should echo whatever we sent it
        if (ws.read(str)) {
            pc.printf("rcv'd: %srn", str);
        }
    }
    ws.close();
    eth.disconnect();
}
And this picture is log message on serial terminal.
Documents
Comments Write