Problem to initilizate W5500

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

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

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 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.

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

Hi!

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

This is my SPI configuration:


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

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);

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.

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