[From QnA] W5200 data sending problem


#1

This post came from QnA of WIZnet website

I have a WIZ820IO module including W5200.
initialization of W5200 is done properly and when I connect the cable to my PC’s ethernet port
the local area connection is established. I can ping the W5200 from my PC and it responds.
the tcp connection can be established in both server and client mode. at this level everything is fine.
even when I send data from PC to W5200 I can receive the data in microcontroller without any problem.
the problem is that when i try to send data from W5200 to PC then W5200 goes to a bad state and
does not respond to any command on SPI interface.
I think that the problem comes from TX_WR pointer. I’ve checked that after the establishment of the connection, TX_WR has random and strange values (like 0xB411, 0xBDB3, 0xBE99, 0xC025, …)
does anyone here has this problem too?

wiznet guys please give me an answer. I need to know if this problem can be solved or i should give up.


#2

Dear customer,

Thanks for your interest in WIZ820io.
I apologize for the late response.
I’d like to ask you few question for correct answer.

  1. Do you use our driver without any modification?
  2. When does the problem occur?
    (For example, as soon as data transmission begin or during data transmission)
  3. What do you set up the Sn_TX_FSR and socket number?
    Please send me the packet capture(wireshark)via e-mail when problem occur.
    The packet capture file has to show WIZ820io status during operation.
    e-mail : support@wiznet.co.kr
    I’ll look over your packet capture file and contact you as soon as possible.

****reference ****
The Sn_TX_WR value changes after the successful send command(Sn_CR(SEND_OK)).
The value of FSR can be 0 when send_OK interrupt generated.
Because send_OK interrup just can indicate the send procedure is completed, but cannot indicate the ACK is received.
The space of TX buffer is locked until our chip receive the ACK, otherwise our chip will do re-transmission operation.
You can image that if our TX buffer is cleared before ACK arrival, how to do the re-send.
Please note: “the TX buffer is locked” doen’t mean all the space of TX buffer is locked. Only the space that you sent in last time. For example if you set the TX buffer of socket0 as 4K and sent 1K data. In this case, before ACK arrival, 3K space is available even if the send_ok interrupt has already generated.

Thanks,
WIZnet


#3

Thank you for reply.

1 - I am using your driver, I’ve just modified it to use it in c++
2 - when i call the socket_send function in socket.c which calls the send_data_processing function
3 - I have set up the TXMEM_SIZE and RXMEM_SIZE of all sockets to 2K. before i write the data to tx buffer the Sn_TX_FSR value is 2048 (completely empty)

I’ll capture the packets and send to you as soon as possible


#4

Dear customer,

Thanks for your interest in W5200.
I saw packet capture file and I found an unnatural point of the packet capture file.
After num ‘7’ in packet capture file(ACK from W5200), AsusteckC don’t sent ACK+SYN to W5200.
Why don’t you been sent ACK and SYN?

thanks,
WIZnet


#5

Dear WIZnet

I am using hercules utility on my PC to send and receive tcp packets.
so I don’t have direct control to TCP layer.
I’ll test some other tools to test the tcp/ip layer. I’ll let you know if find the problem


#6

Dear customer,

Thanks for your interest in w5200.
TX memcopy wr_pointer and phycial TX wr_pointer is difference.
phycial TX wr_pointer value range has from 0 to 0xFFFF and TX memcopy wr_pointer value range has CH_BASE + ch * CH_SIZE + 0x0024.
I think that you read the phycial TX wr_pointer.
For more detailed information about TX_WR pointer, please refer to manual(V1.2.8 P37~38)

thanks,
WIZnet


#7

[quote=“hkjung”]This post came from QnA of WIZnet website

I have a WIZ820IO module including W5200.
initialization of W5200 is done properly and when I connect the cable to my PC’s ethernet port
the local area connection is established. I can ping the W5200 from my PC and it responds.
the tcp connection can be established in both server and client mode. at this level everything is fine.
even when I send data from PC to W5200 I can receive the data in microcontroller without any problem.
the problem is that when i try to send data from W5200 to PC then W5200 goes to a bad state and
does not respond to any command on SPI interface.
I think that the problem comes from TX_WR pointer. I’ve checked that after the establishment of the connection, TX_WR has random and strange values (like 0xB411, 0xBDB3, 0xBE99, 0xC025, …)
does anyone here has this problem too?

wiznet guys please give me an answer. I need to know if this problem can be solved or i should give up.[/quote]

I have no idea why WIZnet do not have an idea about all these problems, they just quote the incomplete documentation and never address the problem, maybe they don’t know either. Yes, I have just struggled with these issues as I couldn’t overwrite the TX_WR and other registers, not until a connection was established anyway. I was getting garbage on my first send which I eventually tracked down to my update method for the TX_WR which was applying the mask before write, right? Wrong! It needs to have it’s high order bits as they are so I just increment the pointer and writ e it back then apply the mask when calculating the transmit buffer write adress. Maybe I will find some other strange issues too. There should be a place in this wiki for documenting these issues and fixes.

BTW, the TX_WR value is random, so just work with it! :slight_smile: