WIZnet Developer Forum

Unable to write port no on w5500

Hi,

I am tried to start the server with socket 0 in port 80. But while i am the reading the register back i am getting zeros.

Here is the screen shot and part of the code

void socket_write(uint8_t reg_off, uint8_t val){
           CB_ChipSelect();
            SPI1_Write(0x00);
            SPI1_Write(reg_off);
            SPI1_Write(0x0E);
            SPI1_Write(val);
            CB_ChipDeselect();
}

uint8_t socket_read(uint8_t reg_off){

        uint8_t val;
           CB_ChipSelect();
            SPI1_Write(0x00);
            SPI1_Write(reg_off);
            SPI1_Write(0x08);
            val = SPI1_Read(0);
            CB_ChipDeselect();
            return val;
}

        socket_write(0x00, 0x01);
        socket_write(0x04, 0x00);
        socket_write(0x05, 0x50);
        socket_write(0x01, 0x01);
        socket_write(0x01, 0x02);


        while(1){
                  val  = socket_read(0x04);
                  UART1_Write(val);
                  val  = socket_read(0x05);
                  UART1_Write(val);
                  val =    getSn_SR(SOCK_WEBSERVER);
                  UART1_Write(val);
        }

Thanks.

Some information you write to registers does not read back properly until you open the socket or perform connect/listen request.

Hi Eugeny,

I am reading the register after making the socket open and listen for incoming connection, because of this i am getting RST, ACK packet every time for every SYN packet i send.

Ok, then make dump of all the register set - common reg set and socket reg set after you put socket into listening state, and post it here so that we can see what you can read from W5500 registers.

Here values of my common register after opening the socket starting from 0x00 to 0x39

Here are the values for the socket 0 registers starting from 0x00 to 0x2F

SUBR being all zeros does not look right.

First of all, achieve situation when remote PC will be able to connect to your W5500, for this you must ensure you set W5500 properly (write all those registers, even if they do not read the same value you wrote).

As soon as PC will connect, I bet you will see, for example, 0x50 in Sn_PORT (if you use HTTP).

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