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