---
title: "Problem to initilizate W5500"
url: "https://maker.wiznet.io/forum/13709"
markdown_url: "https://maker.wiznet.io/forum/13709/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Glomumu"
created: "2020-02-18T10:54:47+09:00"
last_activity: "2020-02-27T12:17:18+09:00"
language: "en"
views: 1151
replies: 4
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Problem to initilizate W5500

## Question

Asked by Glomumu on 2020-02-18 in Ethernet Chips.

Hi! I am new using W5500, and I’m using it with microprocessor of renesas, specifically the one, and I am using the e2 studio to program it. I want to do a webservice but I don’t know much about networks.

I’m follow next link because STM IDE it’s to similar to e2studio

![](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/9/930545c6828f0cde0c5593056a226a6a09e93f78.png) [Carmine Noviello - A blog about programming and electronics – 28 Aug 15](https://www.carminenoviello.com/2015/08/28/adding-ethernet-connectivity-stm32-nucleo/)

![](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/1/17d828727e35cf88ede2c2fbfbf3e9b1036f7c26.jpeg)

### [Adding ethernet connectivity to a STM32-Nucleo - Carmine Noviello - A blog...](https://www.carminenoviello.com/2015/08/28/adding-ethernet-connectivity-stm32-nucleo/)

One drawback of the Nucleo ecosystem is the lack of a version with ethernet connectivity or a dedica

I’m using iolibrary for W5500 and my problem is when I set the information.

I’m using logic analyser and I debug the program step by step in function wizchip_setnetinfo, specifically in setSHAR, setGAR, setSUBR and setSUBR

void wizchip_setnetinfo(wiz_NetInfo* pnetinfo)
{
setSHAR(pnetinfo->mac);
setGAR(pnetinfo->gw);
setSUBR(pnetinfo->sn);
setSIPR(pnetinfo->ip);
*DNS*[0] = pnetinfo->dns[0];
*DNS*[1] = pnetinfo->dns[1];
*DNS*[2] = pnetinfo->dns[2];
*DNS*[3] = pnetinfo->dns[3];
*DHCP* = pnetinfo->dhcp;
}

I could see in MOSI channel that it is sending 0x00

[![WIZNET1](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/3/30bc6f8e44266aebd60c786d5bc6a5f45c5ab086.jpeg) WIZNET11919×764 126 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/3/30bc6f8e44266aebd60c786d5bc6a5f45c5ab086.jpeg)

In function wizhip_getnetinfo, I obtain all parameters as 0 (ip, gateway, mac…)

I’m using this code:
{
uint8_t retVal, sockStatus;
int16_t rcvLen;
uint8_t rcvBuf[20], bufSize = {2, 2, 2, 2};

```
    uint8_t codigo[1];

    reg_wizchip_cs_cbfunc(cs_sel, cs_desel);
    reg_wizchip_spi_cbfunc(spi_rb, spi_wb);

    wizchip_init(bufSize, bufSize);
    wiz_NetInfo netInfo = { .mac   = {0x6c, 0xfd, 0xb9, 0x52, 0xf9, 0x38}, // Mac address
                             .ip   = {192, 168, 1, 195},                   // IP address
                             .sn   = {255, 255, 255, 0},                   // Subnet mask
                             .gw   = {192, 168, 2, 1}};                    // Gateway address
    wizchip_setnetinfo(&netInfo);
    wizchip_getnetinfo(&netInfo);


    // Open socket 0 as TCP_SOCKET with port 5000
      if(((retVal = socket(0, Sn_MR_TCP, 5000, 0))) == 0)
```

…
}

I’m including libraries and I’m starting SPI before this code run. Also, I use cs_sel, cs_desel, spi_rb and spi_wb according to the tutorial of [Adding ethernet connectivity to a STM32-Nucleo](https://www.carminenoviello.com/2015/08/28/adding-ethernet-connectivity-stm32-nucleo/) and my configuration

To configure netinfo, I use cmd-> ipconfig/all to see information but I’m not sure if this information is correct.

My questions are:

- How I can know netinfo is correct?

- Why it didn’t send the correct information across logic analyser?

- Why I’m receiving net inforamtion as 0?

I’m student and I’m trying to learn about this kind of networks, and I’m searching in forum about this problem, but I can’t know why it is falling.

I would appreciate any possible help.

## Replies

### Reply 1 by becky, 2020-02-19

I think that SPI connection does not work. Please check Configuring SPI Interface.

### Reply 2 by Glomumu, 2020-02-20 (in reply to reply 1)

Hi!

I have checked SPI configuration and I think it’s OK.

This is my SPI configuration:

[![Ethernet1](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/3/39695776fdf762816a374a5c1583a151c55b444e.jpeg) Ethernet11400×1749 492 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/3/39695776fdf762816a374a5c1583a151c55b444e.jpeg)

I will post another message to put more info with images (new members only can show one image xD)

### Reply 3 by Glomumu, 2020-02-20

I added a callback function to my code, and now, if I debug step by step these lines:

```
wizchip_init(bufSize, bufSize);
    wiz_NetInfo netInfo = { .mac   = {0x6c, 0xfd, 0xb9, 0x52, 0xf9, 0x38}, // Mac address
                             .ip   = {192, 168, 1, 195},                   // IP address
                             .sn   = {255, 255, 255, 0},                   // Subnet mask
                             .gw   = {192, 168, 2, 1}};                    // Gateway address
    wizchip_setnetinfo(&netInfo);
    wizchip_getnetinfo(&netInfo);
```

I obtain this in the analyser:

- First image is what I obtain for wizchip_init(bufSize, bufSize);

- Second image is what I obtain for wizchip_setnetinfo(&netInfo);

- Third image is what I obtain for wizchip_getnetinfo(&netInfo);

[![Ethernet3](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/4/4a02e9077d79d4608ab82849b058e38c89dafe84.jpeg) Ethernet31920×3304 454 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/4/4a02e9077d79d4608ab82849b058e38c89dafe84.jpeg)

Also, when I execute wizchip_getnetinfo(&netInfo); and watch the result,I obtain next results in netinfo:
mac={0,0,2,2,3,3}
ip={0,0,2,2}
sn={0,0,2,2}
gw={0,0,2,2}

I read in other post that obtain 0x01,0x02,0x03 in MISO is a good conection, but my wiznet return bad info.

I don’t know if it could be a bad clock configuration.

I would appreciate any possible help.

### Reply 4 by Glomumu, 2020-02-27

Hi!!

I solucionate my issue. I added a little delay in my code (100 us) after read and write and I see clearly the comunication in the analiser.

Now, I can ping my chip and get OK

---

Source: https://maker.wiznet.io/forum/13709
