WIZnet Developer Forum

Wiz550io does not ping

Hello!
I am using Wiz550io V1.3 together with STM32F401 DISCOVERY. I use CubeMX32 and IAR EW for ARM. I want to ping the module, but I don’t get a response from it. My code:

/* USER CODE BEGIN Includes /
#include “stm32f4xx_hal.h”
#include “wizchip_conf.h”
#include “socket.h”
#include “loopback.h”
#define HTTP_SOCKET 1
#define SOCK_TCPS 0
#define PORT_TCPS 5000
#define DATA_BUF_SIZE 2048
uint8_t gDATABUF[DATA_BUF_SIZE];
uint8_t buf[2] = {0x00, 0x00};
uint8_t buf_mac[6] = {0,0,0,0,0,0};
uint8_t
pbuf_mac = &buf_mac[0];
uint8_t buf_ip[4] = {0,0,0,0};
uint8_t* pbuf_ip = &buf_ip[0];
uint8_t buf_mask[4] = {0,0,0,0};
uint8_t* pbuf_mask = &buf_mask[0];
uint8_t buf_gate[4] = {0,0,0,0};
uint8_t* pbuf_gate = &buf_gate[0];
uint8_t buf_dns[4] = {0,0,0,0};
uint8_t* pbuf_dns = &buf_dns[0];
uint8_t myip[7] = {0x00, 0x0F, 0x04, 0xC0, 0xA8, 0x2D, 0x0C};
uint8_t mymac[9] = {0x00, 0x09, 0x00, 0x00, 0x08, 0xDC, 0x5F, 0x39, 0x4C};
/* USER CODE END Includes */

/* Private function prototypes ----------------------------------------------- /
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_SPI1_Init(void);
static void MX_TIM1_Init(void);
static void MX_USART6_UART_Init(void);
/
USER CODE BEGIN PFP /
void usDelay(uint32_t time); // timer
void W5500_Select(); // Chip select
void W5500_Unselect(); // Chip unselect
void W5500_ReadBuff(uint8_t
buff, uint16_t len);
void W5500_WriteBuff(uint8_t* buff, uint16_t len);
void W5500_WriteByte(uint8_t byte);
void sendinfo ();
void sendinfo1 ();
/* USER CODE END PFP */

/* USER CODE BEGIN 0 */
uint8_t W5500_ReadByte(void)
{
uint8_t byte;
W5500_ReadBuff(&byte, sizeof(byte));
return byte;
}

wiz_NetInfo gWIZNETINFO = { .mac = {0x00, 0x08, 0xdc, 0x5f, 0x39, 0x4a},
.ip = {192, 168, 22, 3},
.sn = {255, 255, 255, 0},
.gw = {192, 168, 88, 1},
.dns = {0, 0, 0, 0},
.dhcp = NETINFO_STATIC };
/* USER CODE END 0 */

int main(void)
{
/* Initialize all configured peripherals /
MX_GPIO_Init();
MX_SPI1_Init();
MX_TIM1_Init();
MX_USART6_UART_Init();
/
USER CODE BEGIN 2 */

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_RESET); // Pin nRESET down
usDelay(501);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET); // Pin nRESET up
usDelay(1010);

uint8_t rx_buff_sizes[8] = {2, 2, 2, 2, 2, 2, 2, 2};
uint8_t tx_buff_sizes[8] = {2, 2, 2, 2, 2, 2, 2, 2};

wizchip_init(tx_buff_sizes, rx_buff_sizes);

reg_wizchip_cs_cbfunc(W5500_Select, W5500_Unselect);
reg_wizchip_spi_cbfunc(W5500_ReadByte, W5500_WriteByte);
reg_wizchip_spiburst_cbfunc(W5500_ReadBuff, W5500_WriteBuff);

wizchip_setnetinfo(&gWIZNETINFO);
sendinfo(); // send to PC by UART all gWIZNETINFO
wizchip_getnetinfo(&gWIZNETINFO);
usDelay(1000);
sendinfo();
}

void W5500_Select(void)
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
}
void W5500_Unselect(void)
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);
}
void W5500_ReadBuff(uint8_t* buff, uint16_t len)
{
HAL_SPI_Receive(&hspi1, buff, len, 0xFFFFFFFF);
}
void W5500_WriteBuff(uint8_t* buff, uint16_t len)
{
HAL_SPI_Transmit(&hspi1, buff, len, 0xFFFFFFFF);
}
void W5500_WriteByte(uint8_t byte)
{
W5500_WriteBuff(&byte, sizeof(byte));
}

I watched the signal using an oscilloscope and see how packets go via SPI to the module by the command win chip_set net info and the module responds by the command wizchip_getnetinfo. I made a sendinfo(); function that sends gWIZNETINFO over UART to COM port PC and I see this:
00 00 00 00 00 00 - mac
00 00 00 00 - ip
3F FF FF FC - mask
00 00 00 00 - gate
00 00 00 00 - dns
And these values may vary depending on the day of the week))) (I can’t understand the dependencies of changing this data).

Please tell me, maybe I’m missing something?

Hello
I’m sorry, but I’m not reviewing the code due to the company’s policy.
I will attach the iolibrary for your reference.

Thank you

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.