TCP establised ? watch Sn_IR not Sn_SR for incomming packets

In TCP server (wizwiki.net/wiki/doku.php?id=pro … p_function) w5500 application TCP are described two methods for ESTABLISHMENT First watch the Sn_IR to become CON, SECOND method watch the Sn_SR to become SOCK_ESTABLISHED.
Sn_SR reports that the socket 0 is at listen state and the program watch the Sn_SR
with firefox → 192.168.1.16:9090
Sn_SR doesn’t change state but Sn_IR ==5 Register for received bytes report 0 bytes received
Question Why Sn_SR doesn’t change to Established? method 2 doesn’t work or something is missing to me?
I have to watch sn_IR not SN_SR
I write Sn_IR with 4 (recv) and then Sn_SR change state to Established and bytes Received =303

Sn_IR is read-only register. How do you write it?

To check the socket establishment, you just need to check method 1 or 2.
If Sn_SR is not changed, I think it’s firmware problem. Please debug it with Wireshark(wireshark.org).

I don’t agree . . . .
copping from URL above

This say that I have to write 1 to Sn_IR for the recv bit (0x4)

copping from datasheet

[quote]Sn_IR (Socket n Interrupt Register) [R] [0x0002] [0x00]
Sn_IR indicates the status of Socket Interrupt such as establishment, termination,
receiving data, timeout). When an interrupt occurs and the corresponding bit of
Sn_IMR is ‘1’, the corresponding bit of Sn_IR becomes ‘1’.
In order to clear the Sn_IR bit, the host should write the bit to ‘1’.[/quote]

At first line it say that is only Read
At last line it say that “the host should write the bit to 1”

This is that I do and is right
Possibly typographic error at datasheet ??? :exclamation:
I , already, have over seven days of detailed reading of the datasheet and the url above.
specially to underspend what is the Address Phase -->call me : Offset Address
Now, code works OK . I will open a new thread with functions to read and write the chip

Hi,

Sn_IR can be both readable and writable. You are right!!!.

I wonder that it is correct information as Sn_SR and the received byte size after Sn_IR(4) was written?

For more detail, can you post the source codes and the packet captured file by wireshark.

Thank you.

Hi~~
minis

You are right.

Sn_IR is used to write in order to clear the Sn_IR bit.
User can not write some value as like another register.

For example,
- Mode register : You can write ‘0x20’ to set WOL and can read “0x20”.
- Sn_IR : You can write the ‘0x10’ for clear SEND_OK bit and can not read the setting value “0x10”.
Because Sn_IR clear automatically this bit(SEND_OK).

thanks,
EK :slight_smile:

I begin this thread because of in the url mentioned on #1 describes two methods to see if a client needs to talk.
The Sn_Status register do this job. I spent some days poling sn_sR to change state form Listen to Established ( it is most easy to pole sn_sr ,there is no need to write snsr like snir. b)Suppose that Interrupts are disabled. that means that Sn_IR is off, the only way for the CPU is to pole the Sn_SR.). BUT if you pole sn_ir it has received flag to 1 and if you write 1 to it OHhhh → sn_sr changes state to Established and pointer for bytes received changed from 0 to 303
I haven’t other experience with this chip in other environment , like arduino, or ATmel where there is a ready to use library .
In my project I have to go on . it is little hard to restore passed days backup to examine this point. The time until Aug 3 isn’t too much. I must Hurry up

first I had ping problem -->solved
second SN_Sr → this thread ,solved , any way
now , I have to face other problems concerning the algorithm , when all bytes of the html page are transmitted → how to terminate the conversation (project module TCP server) and the client (PC-firefox) , and begin a new Listen

Hi minas

Please let me know if you have any questions or require any further information.

thanks :slight_smile:

yes, I need some help.
see my other thread about “terminating the conversation with firefox”