WIZnet Developer Forum

W5100 is sending garbage data

Hi,

It is obviously some configuration issue, but I cannot figure out what is the problem.
I start the socket as a TCP server and I can connect from client normally. But when I try to send one char from server to client, client receives some garbage stream.
I have set:

  • tx mem size (0x001B) as 0x55 (2kb per socket)
  • tx write pointer 0x0424 = 0x40
    0x0425 = 0x00

when sending a char i first read the txWritePtr, one example is:
0x0424 => 0xD8
0x0425 => 0x90
Then i mask the pointer with 0x7ff and add to base addess 0x4000, which gives me address of 0x4090 on which I sent one character.
And after I update txWritePtr with new address
0x0424 = 0x40
0x0425 = 0x91
And of course send the Send command to command register. After that I receive quite amount of garbage (I dont really know how much characters I receive)…

I am sure it is some obvious mistake I am making, but longer I read the datasheet and look at the code, less I have ideas what could be the issue…

Thanks in advance.

HI~ gossamer

If you use the Socket0(allow the 2kb : tx size of socket0), socket0 have tx mem size as 0x4000~ 0x47FF.

And when socket connection is complete, S0_TX_WR value has random value in 0x4000~0x47FF.
It transmits data from current S0_TX_RR to S0_TX_WR and automatically changes after transmission is finished(After send command is completed and S0_IR(SEND_OK) is enable).

And if total TCP packet is less then 60byte, W5100 send 60byte packet including garbage data(padding data).

You need to confirm.

Best regards,
irina

Yeah, I am not talking about padding data. This is like dumping of full buffer before posting the data I have sent.

Yes, I get random value of TX_WR and TX_RR is 0. Which means that every time it will send 0->TX_WR + my data ?

For example, TX_WR = 1000; my data is 24 bytes long, first time I initiate send it will send 1024 bytes, every other send is OK, it will just send 24 bytes.

Do I need to set the RR before writing to tx buffer ?

[quote=“gossamer”]0x0424 = 0x40
0x0425 = 0x91[/quote]
If you use all 16 bits updating the pointer, will that work for you? Thus pointer before you issue SEND command, when sending one char, will be:

0x0424 = 0xD8 0x0425 = 0x91
It sounds logical that you get long stream of garbage. In your case size of calculated data 4091-d890=6801 (26 625 bytes).

Nice !

That was exactly the issue. Writing value on 0x4090, but setting txWritePtr to 0xD891 after writing one character. To be honest datasheet was so vague on this detail, that i would never figure it out :confused:

Thanks Eugeny.

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