Wiz550io missing data from RX buffer

I have set up a TCP server on the wiz550io that is listening on port 80.

When i send a GET request from a web browser(safari seems to work best, but ill get to that later), i read the RXbuffer and it always seems to miss the first few lines of the GET request. The other data that i see in wireshark shows up but i miss out on the actual “GET” part of the request.

I am not using the interrupt method outlined in the documentation, i just poll the Sn_SR, once the sock_established happens i and confirm there is TCP data by using the if(Sn_RX_RSR0!=0x0000) call

once i detect something i get the length of the Sn_RX_RSR
then i read the pointer from the Sn_RX_RD
once i have the pointer and the length i read from the RX buffer into an Array, once i’ve reached the length, i ADD the length i’ve read to the Sn_RX_RD register, then set the Sn_CR = to RECV.

The one thing i notice is if i resend a HTTP request again, then the pointer Sn_RX_RD is the same value as the previous request. I would assume when the next request comes in, the RX buffer pointer should have a new value that is the old value, plus the length of the previous packet.

I am implementing this for a school project on a ZiLog Z8 micro controller so any help would be greatly appreciated. I will post some snippets of code and the debugging data i get from REALTERM asap.

Also if i use firefox or chrome, the array that i copied the RX buffer into looks like all garbled data.

The only browser that seems to elicit some kind of desired response is Safari albeit the first park of the packet is gone. which would make it impossible to tell if i received a Post or a GET command.

Absolutely ANY help would be greatly appreciated

Thanks

Hi,
this happens because sometimes the first part of the request (the header) is sent immediately while the contents thereof undergoes a slight delay. If you’re start immediately in reading missing next parts.
So wait for major chunk size then start or I prefer try doing a seek in the buffer without moving the read pointer.

A GET REQUEST Header is like this …

    GET /yourpage.html HTTP/1.1
    Host: xxx.xxx.xxx.xxx
    Keep-Alive: timeout=xx
    Connection: Keep-Alive
    X-Forwarded-For:  xxx.xxx.xxx.xxx

… then you search for “Connection:” then
seek for “GET /” and take that position
seek for “POST /” and take that position
seek for " HTTP/"

move the read pointer after you have correctly receive the full content and then can prepare the answer.

I am sending a GET request from a web browser.

Safari from either my iPhone or Macbook i end up reading something like the following from the buffer in the Wiznet

[code]Listen function started

Size: 365

RX Buffer Pre_Write: 28788

RX Buffer Post_Write: 29153

Content:ion/xml;q=0.9,/;q=0.8

User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 9_2_1 like Mac OS X) AppleWebKit/

1.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13D15 Safari/601.1

cept-Language: en-ca

che-Control: max-age=0

nection: keep-alive

anguage: en-US,en;q=0.8

-©þIDSå•Z¿ÁNòÙvv2f~†òù•‡±ò?øl¾ùBºµÌz±¼249môèÊ;@µ( ƒŠPw©’hÊ µ
Z@OÖÇy¤˜†Ä

Socket Close!

Sn_Port: 80

Listen function started

Size: 365

RX Buffer Pre_Write: 28788

RX Buffer Post_Write: 29153

ntent:ion/xml;q=0.9,/;q=0.8

User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 9_2_1 like Mac OS X) AppleWebKit/

1.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13D15 Safari/601.1

cept-Language: en-ca

che-Control: max-age=0

nection: keep-alive

Language: en-US,en;q=0.8

-©þIDSå•Z¿ÁNòÙvv2f~†òù•‡±ò?øl¾ùBºµÌz±¼249môèÊ;@µ( ƒŠPw©’hÊ µ
Z@OÖÇy¤˜†Ä

Socket Close!

Sn_Port: 80

Listen function started

Socket Close!

Sn_Port: 80

Listen function started

[/code]

I also notice that the RX buffer pointer seems to jump around depending on whats connecting to it.

When i use Chrome to try and connect to the wiznet the RX pointer always seems to be at 25955, and i update it after i’ve read it and then connect again, the pointer ends up back at 25955 again. even tho i read the pointer after i’ve written to it and display it out my debug under the RX Buffer Post_Write

If i use the ESP2866 TCP test client to connect to the wiznet the point increments correctly each time.


And this is the output of the degugging when i send a get request from Chrome.

Hi,
:frowning:
at this point I have serious doubts about the way in which dialogues with the SPI.
Such as routines used to set and read the registers?
Routines are yours or you went from something that was already there?
Surely you miss something along the way because you always need two bytes to each new-line :

<CR-LF>
<CR-LF>
"cept-Language: en-ca"
<CR-LF>
....
<CR-LF>
"nection: keep-alive"
<CR-LF>
<CR-LF>

…if you spool while arriving you lose time in process the new-line so take a look at your sources.

It turns out i was reading the RX pointer incorrectly. I had the wrong Control byte being sent.

Everything is working great so far.

Thanks for your input Coccoliso! I appreciate it.