W5500 with ESP8266 (RTOS SDK)

Hi,
I’m used the W5500 with a ESP-07 and ESP-12 WiFi module (ESP8266 NONOS SDK) in the Arduino IDE.
The Ethernet library in the Arduino IDE are working fine, but now I need to use the W5500 with the ESP8266 RTOS SDK (FreeRTOS based).
I need help to find the W5500 library that works with the ESP8266 IC (RTOS SDK).

Thank you.

Hi, we didn’t have a library for the ESP8266 using FreeRTOS.
But I can offer a Library and Code at executed another OS.
Please, before import the IoLibrary, you must set the SPI pins and CS pin.
The IoLibrary is changed function names for didn’t conflict RTOS function names.

#include “wizchip_conf.h”
#include “loopback.h”
#define LOOPBACK_TASK_SIZE 256
#define LOOPBACK_TASK_PRIO 10
static OS_STK LoopBackTaskStk[LOOPBACK_TASK_SIZE];
void LoopBackTest(void);
void LoopBack_task(void *sdata);
void W5500_Initialze(void);
void print_network_information(void);
wiz_NetInfo defaultNetInfo = { .mac = {0x00,0x08,0xdc,0xff,0xee,0xdd},
.ip = {192,168,0,130},
//.ip = {222,98,173,241},
.sn = {255,255,255,0},
.gw = {192,168,0,1},
//.dns = {168, 126, 63, 1},
.dns = {8, 8, 8, 8},
.dhcp = NETINFO_STATIC};
unsigned char gServer_IP[4] = {192,168,0,5};
#endif

void UserMain(void)
{

int chipver = 0;
u8_t temp_addr[3] = {0x00, 0x39, 0x01};
printf("\n initialize  W5500\n");

W5500_Initialze();

chipver = getVERSIONR();
printf("chip version = 0x%X\r\n", chipver);
wizchip_setnetinfo(&defaultNetInfo);
print_network_information();
printf("start loopback Task\r\n");

LoopBackTest();

}

#if 1 //teddy 191125

void csEnable(void)
{

tls_gpio_write(WM_IO_PB_15, 0);

}

void csDisable(void)
{

tls_gpio_write(WM_IO_PB_15, 1);

}

void spiWriteByte(uint8_t tx)
{

uint8_t rx;
tls_spi_write(&tx, 1);

}

uint8_t spiReadByte(void)
{

uint8_t rx = 0;
tls_spi_read(&rx, 1);
return rx;

}

void W5500_Initialze(void)
{

csDisable();
reg_wizchip_cs_cbfunc(csEnable, csDisable);
reg_wizchip_spi_cbfunc(spiReadByte,spiWriteByte);
reg_wizchip_spiburst_cbfunc(tls_spi_read, tls_spi_write );
uint8_t tmp;
uint8_t memsize[2][8] = { {2,2,2,2,2,2,2,2},{2,2,2,2,2,2,2,2}};
if(ctlwizchip(CW_INIT_WIZCHIP,(void*)memsize) == -1)
{
    printf("WIZCHIP Initialized fail.\r\n");
  return;
}
#if 1
/* PHY link status check */
do {
    if(ctlwizchip(CW_GET_PHYLINK, (void*)&tmp) == -1)
    {
      printf("Unknown PHY Link status.\r\n");
      return;
    }
} while (tmp == PHY_LINK_OFF);
#endif

}

void print_network_information(void)
{

wizchip_getnetinfo(&defaultNetInfo);
printf("Mac address: %02x:%02x:%02x:%02x:%02x:%02x\n\r",defaultNetInfo.mac[0],defaultNetInfo.mac[1],defaultNetInfo.mac[2],defaultNetInfo.mac[3],defaultNetInfo.mac[4],defaultNetInfo.mac[5]);
printf("IP address : %d.%d.%d.%d\n\r",defaultNetInfo.ip[0],defaultNetInfo.ip[1],defaultNetInfo.ip[2],defaultNetInfo.ip[3]);
printf("SM Mask    : %d.%d.%d.%d\n\r",defaultNetInfo.sn[0],defaultNetInfo.sn[1],defaultNetInfo.sn[2],defaultNetInfo.sn[3]);
printf("Gate way   : %d.%d.%d.%d\n\r",defaultNetInfo.gw[0],defaultNetInfo.gw[1],defaultNetInfo.gw[2],defaultNetInfo.gw[3]);
printf("DNS Server : %d.%d.%d.%d\n\r",defaultNetInfo.dns[0],defaultNetInfo.dns[1],defaultNetInfo.dns[2],defaultNetInfo.dns[3]);

}

void LoopBackTest(void)
{

tls_os_task_create(NULL, NULL,
                   LoopBack_task,
                   NULL,
                   (void *)LoopBackTaskStk,          /* task's stack start address */
                   LOOPBACK_TASK_SIZE * sizeof(u32), /* task's stack size, unit:byte */
                   LOOPBACK_TASK_PRIO,
                   0);

}

void LoopBack_task(void *sdata)
{

uint8_t eth0_buf[512];
while(1)
{
    loopback_tcps(0, eth0_buf, 5001);
} 

}