IP setup - Ping

Greetings!

I’m starting off with the WIZ850io module and want to configure a custom IP to communicate with my network. I’m setting it up through a SPI connection with CC3220sf chip from Texas Instruments and I’m not able to ping the module afterwards.
The code to configure the module is the following:

void configW5500(){

    SPI_Transaction spiTransaction;
    bool transferOK = 0;
    uint8_t wBuff[30], aux = 0;

    //Common Register Block
    wBuff[aux++] = 0; //Common Register Block Address
    wBuff[aux++] = MODE_OFFSET;
    wBuff[aux++] = (COMMON_REGISTER_BLOCK << 3) + (ETHERNET_WRITE << 2) + CS_MODE; //Control Byte
    wBuff[aux++] = 0b00000000; //Mode.-(7)RST|(6)RESERVED|(5)WOL|(4)PING BLOCK|(3)PPPoE|(2)RESERVED|(1)FARP|(0)RESERVED
    wBuff[aux++] = 192; //Gateway IP Address
    wBuff[aux++] = 168;
    wBuff[aux++] = 1;
    wBuff[aux++] = 65;
    wBuff[aux++] = 255; //Gateway Subnet Mask
    wBuff[aux++] = 255;
    wBuff[aux++] = 255;
    wBuff[aux++] = 0;
    wBuff[aux++] = 0xCC; //Source HW Offset
    wBuff[aux++] = 0x48;
    wBuff[aux++] = 0x3A;
    wBuff[aux++] = 0x44;
    wBuff[aux++] = 0xAD;
    wBuff[aux++] = 0xE0;
    wBuff[aux++] = 192; //Source IP Address
    wBuff[aux++] = 168;
    wBuff[aux++] = 1;
    wBuff[aux++] = 50;
    wBuff[aux++] = 0; //Interrupt Low Level Timer
    wBuff[aux++] = 0;
    wBuff[aux++] = 0xFF; //Interrupt Register (read only, initializing here)
    wBuff[aux++] = 0b11110000; //Interrupt Mask.- Habilito las 4 que hay

    spiTransaction.count = aux; //Tamanho del mensaje a transmitir por SPI
    spiTransaction.txBuf = (void *)wBuff; //Buffer a enviar
    spiTransaction.rxBuf = NULL; //Buffer de recepcion. Solamente se envia, por lo que es NULL
    spiTransaction.arg = NULL;
    aux = 0;

    gSPIMaster = SPI_open(CONFIG_SPI_Master, &spiParams); //Apertura del canal SPI

    GPIO_write(GPIO_CS_ETHERNET, CS_ETHERNET_ENABLE);
    transferOK = SPI_transfer(gSPIMaster, &spiTransaction); //Transferencia por SPI, con parametro 1 el handle del SPI y 2 el mensaje
    GPIO_write(GPIO_CS_ETHERNET, CS_ETHERNET_DISABLE);

    wBuff[aux++] = 0;
    wBuff[aux++] = SOCKET_INTERRUPT_MASK_OFFSET;
    wBuff[aux++] = (COMMON_REGISTER_BLOCK << 3) + (ETHERNET_WRITE << 2) + CS_MODE; //Control Byte
    wBuff[aux++] = 0b11111111; //Socket Interrupt Mask
    wBuff[aux++] = 0x07; //Retransmision Timeout Period (0x07D0 = 2000 aka 200 ms)
    wBuff[aux++] = 0xD0;
    wBuff[aux++] = 9; //Retransmision Count.- (9 + 1)x200 ms = 2 seg
    wBuff[aux++] = 200; //PPP Link Control Protocol Request Timer.- 200x25 ms = 5 seg
    wBuff[aux++] = 0x01; //PPP Link Control Protocol Magic Number
    wBuff[aux++] = 0x00; //Destination Hardware Address Register in PPPoE mode (PPPoE disabled???????)
    wBuff[aux++] = 0x00;
    wBuff[aux++] = 0x00;
    wBuff[aux++] = 0x00;
    wBuff[aux++] = 0x00;
    wBuff[aux++] = 0x00;
    wBuff[aux++] = 0x00; //Session ID Register in PPPoE Mode (PPPoE disabled???????)
    wBuff[aux++] = 0x00;
    wBuff[aux++] = 0x00; //Maximum Receive Unit in PPPoE Mode (PPPoE disabled???????)
    wBuff[aux++] = 0x00;
    wBuff[aux++] = 192; //Unreachable IP Address
    wBuff[aux++] = 168;
    wBuff[aux++] = 1;
    wBuff[aux++] = 40;
    wBuff[aux++] = 0x12; //Unreachable Port
    wBuff[aux++] = 0x34;
    wBuff[aux++] = 0b01111100; //PHY Configuration (RESET)

    spiTransaction.count = aux; //Tamanho del mensaje a transmitir por SPI
    aux = 0;

    GPIO_write(GPIO_CS_ETHERNET, CS_ETHERNET_ENABLE);
    transferOK = SPI_transfer(gSPIMaster, &spiTransaction); //Transferencia por SPI, con parametro 1 el handle del SPI y 2 el mensaje
    GPIO_write(GPIO_CS_ETHERNET, CS_ETHERNET_DISABLE);

    wBuff[aux++] = 0;
    wBuff[aux++] = PHY_CONFIG_OFFSET;
    wBuff[aux++] = (COMMON_REGISTER_BLOCK << 3) + (ETHERNET_WRITE << 2) + CS_MODE; //Control Byte
    wBuff[aux++] = 0b11111100; //PHY Configuration (despues de RESET)

    spiTransaction.count = aux; //Tamanho del mensaje a transmitir por SPI
    aux = 0;

    GPIO_write(GPIO_CS_ETHERNET, CS_ETHERNET_ENABLE);
    transferOK = SPI_transfer(gSPIMaster, &spiTransaction); //Transferencia por SPI, con parametro 1 el handle del SPI y 2 el mensaje
    GPIO_write(GPIO_CS_ETHERNET, CS_ETHERNET_DISABLE);

    SPI_close(gSPIMaster); //Cerrado del canal SPI
    gSPIInUsed = FALSE;
}

Note that MODE_OFFSET is 0x0000, SOCKET_INTERRUPT_MASK_OFFSET is 0x0018 and PHY_CONFIG_OFFSET is 0x002E.

I’m able to see the correct data been sent through the SPI with an oscilloscope. My PC has assigned the IP 192.168.1.65 and my router has 192.168.1.1

Any advices?
Thanks in advance

Read written register values back to prove the correct values.

I am able to read all the configured values correctly. Having the following:

  • 192.168.1.1 Gateway IP (my router)
  • 192.168.1.50 Source Hardware IP (I’m guessing W5500 IP right?)

I try sending a ping with the device connected to my router as well as directly to my PC (both regular and crosover ethernet cable) without success. When connecting it to my PC, I made sure my PC had the “Gateway IP” per configuration in the W5500.

I would start with the following:

  1. ensure proper hardware reset with the W5500 reset pin after power up.
  2. perform software reset using MR pin after hardware reset. I am more than sure it is redundant to hardware reset, but would do it anyway.
  3. write only required information for the ping: SHAR, SIP, GAR, leaving everything else as default.
  4. use direct connect to PC with Wireshark running, turn on W5500, ensure there’s a link up, wait a minute and perform ping, and then see if there’s anything from W5500 in the Wireshark log.