Connect() does not return TIMEOUT error
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: Connect() does not return TIMEOUT error
by irinakim ·
Hi~ avivf
This is valid only in TCP mode and operates when Socket n acts as ‘TCP client’.
And the connect-request fails in the following three cases.
Is it timeout error?
Thanks,
EK
RE: Connect() does not return TIMEOUT error
by avivf ·
Hello,
thanks for reply.
Well, as I said the problem is that the connect procedure fails, as socket did not get to SOCK_ESTABLISHED state.
I expect the w5500 to return timeout error upon checking the proper register
getSn_IR(sn) & Sn_IR_TIMEOUTFor some reason w5500 does not identify that timeout has passed, though the timeout register is set to 15000 (the timeout value is read from the w5500 using
ctlnetwork(CN_GET_TIMEOUT,...)As NO timeout occurred - the loop is endless.
Can you figure out why w5500 does not get into timeout?
Thanks,
Aviv
RE: Connect() does not return TIMEOUT error
by irinakim ·
Hi…
I think you set a lot of timeout value.
Please add the code and test again.
function declaration in main.c
You have to insert this code before TCP client test function execute.
And do you send your test code ?
thanks,
EK
RE: Connect() does not return TIMEOUT error
by avivf ·
Hi EK,
I’ve set the RTR and RCR as you suggested, but it didn’t help.
I will describe the problem once again:
while(getSn_SR(sn) != SOCK_ESTABLISHED) { if (getSn_IR(sn) & Sn_IR_TIMEOUT) { setSn_IR(sn, Sn_IR_TIMEOUT); #if _WIZCHIP_ == 5200 // for W5200 ARP errata setSUBR((uint8_t*)"\x00\x00\x00\x00"); #endif return SOCKERR_TIMEOUT; } }Can you pleae help?
Thanks
RE: Connect() does not return TIMEOUT error
by irinakim ·
Hi~ avivf
I tested our driver.I’m having a bit of trouble with our driver and I modified connect() function in socket.c
The conditional statement added a end conditions(if(getSn_SR(sn) == SOCK_CLOSED)).
It have to confirm the Sn_SR value if SOCK_CLOSED or not.
I updated the driver. Please visit the GitHub for more information.
[url]https://github.com/Wiznet/ioLibrary_Driver/commit/0ada86b800b7c24dc36055388297cf29826c6e46[/url]
RE: Connect() does not return TIMEOUT error
by avivf ·
Thanks.
the fix is correct, though it still misses the case where the socket is disconnected (and not closed).
This is actually the case I was encountered.
I fixed the bug by the following code (which I think needs to be merged with your fix):
while(getSn_SR(sn) != SOCK_ESTABLISHED) { /** * Upon server sending a disconnection msg - getSn_IR(sn) returns "0x2" ( = Sn_IR_DISCON) for ever, * and no time is generated by the w5500. * This leads connect() func to be stuck in endless loop, as NO timeout is received by getSn_IR(sn). * * The fix is adding a Sn_IR_DISCON condition, in order to exit loop. */ if (getSn_IR(sn) & Sn_IR_TIMEOUT) { setSn_IR(sn, Sn_IR_TIMEOUT); #if _WIZCHIP_ == 5200 // for W5200 ARP errata setSUBR((uint8_t*)"\x00\x00\x00\x00"); #endif return SOCKERR_TIMEOUT; } else if (getSn_IR(sn) & Sn_IR_DISCON) { setSn_IR(sn, Sn_IR_DISCON); return (SOCKERR_SOCKSTATUS); } }RE: Connect() does not return TIMEOUT error
by intector ·
Hey,
I had the same issue with the TCP-Client. I tried the solution from avivf and it worked like a charm.
thank you for the help.