WIZnet Developer Forum

W5100 initialize with 2 socket 4k, 1 socket 8k not working

Hey Everyone,

I am using the ioLibrary to work with a nRF52840. I want to set socket size to 2x4k or 1x8k but it is not working out for me .

This is the init code I am using for the wiznet 5100:

void user_ethernet_init()
    uint8_t memsize[2][8] = {{2,2,2,2,2,2,2,2},{2,2,2,2,2,2,2,2}};
    wiz_NetTimeout timeout_info;

    reg_wizchip_cs_cbfunc(wizchip_select, wizchip_deselect);
    reg_wizchip_spi_cbfunc(wizchip_read, wizchip_write);

    /* WIZCHIP SOCKET Buffer initialize */
    printf("W5100 memory init\r\n");

    if(ctlwizchip(CW_INIT_WIZCHIP,(void*)memsize) == -1)
    	printf("WIZCHIP Initialized fail.\r\n");

    uint32_t tmp;

    /* PHY link status check */
    printf("W5100 PHY Link Status Check\r\n");
       if(ctlwizchip(CW_GET_PHYLINK, (void*)&tmp) == -1)
    	   printf("Unknown PHY Link stauts.\r\n");
    }while(tmp == PHY_LINK_OFF); 

    timeout_info.retry_cnt = 1;
    timeout_info.time_100us = 0x3E8;	// timeout value = 10ms

    /* Network initialization */

It is code I found for an example with the W5500 ( http://wizwiki.net/wiki/doku.php?id=oshw_using_wiznet:bletoethernet)
I tried the memsize on
uint8_t memsize[2][8] = {{4,4,0,0,0,0,0,0},{4,4,0,0,0,0,0,0}};
uint8_t memsize[2][8] = {{8,0,0,0,0,0,0,0},{8,0,0,0,0,0,0,0}};

uint8_t memsize[2][4] = {{4,4,0,0},{4,4,0,0}};
uint8_t memsize[2][4] = {{8,0,0,0},{8,0,0,0}};

But then the socket sizes become only 1k, or it does not work at all.
Can someone give me a pointer to what I am doing wrong ?

Thanks in advance,


I have a suspicion that you must use code and libraries oriented for W5100. Fianlly W5100 does not have PHY register. Thus the code you use may simply be totally wrong for W5100.

The IO library you wrote yourself is made for the W5100 right? I am using a own written file to use the ioLibrary like any application or program will. I can’t just use the library and be happy, I have to write my own application code.

So do you maybe have a good idea or help how I can set 2 sockets for 4k each ?
Just saying that what I am doing is wrong, is not really helping.

You must write 0x0A to RMSR and TMSR.

When you ask questions here you are expected to have an understanding what is written in the datasheet for the device you are programming, and that there’s no PHYCFG register in there.

Thanks for your response.

I am using :

setSn_TXBUF_SIZE(0, 0x0A);
setSn_RXBUF_SIZE(0, 0x0A);

but the size still stays 2 on all the sockets.

I also tried :

setSn_TXMEM_SIZE(0, 0x0A);
setSn_RXMEM_SIZE(0, 0x0A);

Cant I use the " CW_INIT_WIZCHIP " and the 2d array.

Can you help me to set the 2d array so that I have 1 socket of 8rx and 8tx

uint8_t memsize[2][8] = {{2,2,2,2,2,2,2,2},{2,2,2,2,2,2,2,2}};

Sorry I used PHY link with a wrong chip, I am just really new to this all. So I don’t have the same experience as you all do. You have to start somewhere right? And make mistakes, really nice that you still help me.

I am looking the wizchip_conf.h in the ioLibrary with

typedef enum
   CW_RESET_WIZCHIP,   ///< Resets WIZCHIP by softly
   CW_INIT_WIZCHIP,    ///< Initializes to WIZCHIP with SOCKET buffer size 2 or 1 dimension array typed uint8_t.
   CW_GET_INTERRUPT,   ///< Get Interrupt status of WIZCHIP
   CW_CLR_INTERRUPT,   ///< Clears interrupt
   CW_SET_INTRMASK,    ///< Masks interrupt
   CW_GET_INTRMASK,    ///< Get interrupt mask
   CW_SET_INTRTIME,    ///< Set interval time between the current and next interrupt. 
   CW_GET_INTRTIME,    ///< Set interval time between the current and next interrupt. 
   CW_GET_ID,          ///< Gets WIZCHIP name.

//D20150601 : For no modification your application code
//#if _WIZCHIP_ ==  5500
   CW_RESET_PHY,       ///< Resets internal PHY. Valid Only W5500
   CW_SET_PHYCONF,     ///< When PHY configured by internal register, PHY operation mode (Manual/Auto, 10/100, Half/Full). Valid Only W5000
   CW_GET_PHYCONF,     ///< Get PHY operation mode in internal register. Valid Only W5500
   CW_GET_PHYSTATUS,   ///< Get real PHY status on operating. Valid Only W5500
   CW_SET_PHYPOWMODE,  ///< Set PHY power mode as normal and down when PHYSTATUS.OPMD == 1. Valid Only W5500
//D20150601 : For no modification your application code
//#if _WIZCHIP_ == 5200 || _WIZCHIP_ == 5500
   CW_GET_PHYPOWMODE,  ///< Get PHY Power mode as down or normal, Valid Only W5100, W5200
   CW_GET_PHYLINK      ///< Get PHY Link status, Valid Only W5100, W5200

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