W5500 TCP Server Mode
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: W5500 TCP Server Mode
by Eugeny ·
There’s no such state for the socket.
Bit 4 set means SEND_OK.
If this bit is reset, then either respective bit is not set in Sn_IMR, or there were no completed SEND command, or this bit was cleared by the user code.
RE: RE: W5500 TCP Server Mode
by Century ·
If SEND_OK command is reset, I am making it set and transmitting again.
But sometimes I am getting Sn_SR command 0x1E or 0x2E, after that it goes to close state and again I am calling Initialization of W5500 chip.
What could be the problem?
RE: RE: W5500 TCP Server Mode
by Century ·
This thread, May be I thought wrong,
RE: W5500 TCP Server Mode
by Eugeny ·
SEND_OK is not a command, it is flag in Sn_IR register.
How you do it? You mean in Sn_IMR register?
Sounds like invalid states. Are you sure SPI communication is reliable?
RE: W5500 TCP Server Mode
by Century ·
I making as follows if I got wrong response
setSn_CR(sn,Sn_CR_SEND); // sn = Socket Number = 0, Sn_CR_SEND = 0x10
/* wait to process the command… */
while(getSn_CR(sn));
As of now I thought it is working properly, But is it require some delay between executing commands?
Sorry for that wrong statement.
RE: W5500 TCP Server Mode
by Eugeny ·
What wrong response you are talking about?
SEND command is code 0x20. Code 0x10 is to close socket!
RE: W5500 TCP Server Mode
by Century ·
I am calling this function every one sec.
This library is downloaded from the github.
int32_t send(uint8_t sn, uint8_t * buf, uint16_t len)
{
uint8_t tmp=0;
uint16_t freesize=0;
CHECK_SOCKNUM();
CHECK_SOCKMODE(Sn_MR_TCP);
CHECK_SOCKDATA();
tmp = getSn_SR(sn);
if(tmp != SOCK_ESTABLISHED && tmp != SOCK_CLOSE_WAIT) return SOCKERR_SOCKSTATUS;
if( sock_is_sending & (1<<sn) )
{
**> tmp = getSn_IR(sn);**Sometimes I am getting wrong response
_NOP() ;
_NOP() ;
// close(sn);
return SOCKERR_TIMEOUT;
}
else
{
setSn_IR(sn, Sn_IR_SENDOK);
_NOP() ;
_NOP() ;
}
freesize = getSn_TxMAX(sn);
if (len > freesize) len = freesize; // check size not to exceed MAX size.
while(1)
{
freesize = getSn_TX_FSR(sn);
_NOP() ;
_NOP() ;
tmp = getSn_SR(sn);
if ((tmp != SOCK_ESTABLISHED) && (tmp != SOCK_CLOSE_WAIT))
{
// close(sn);
return SOCKERR_SOCKSTATUS;
}
if( (sock_io_mode & (1<<sn)) && (len > freesize) ) return SOCK_BUSY;
if(len <= freesize) break;
}
wiz_send_data(sn, buf, len);
_NOP() ;
_NOP() ;
setSn_CR(sn,Sn_CR_SEND);
/* wait to process the command… */
while(getSn_CR(sn));
sock_is_sending |= (1 << sn);
//M20150409 : Explicit Type Casting
//return len;
return (int32_t)len;
}
Actually this function I am calling.
setSn_IR(sn, Sn_IR_SENDOK);
RE: W5500 TCP Server Mode
by Eugeny ·
What is wrong with this command’s response?
RE: W5500 TCP Server Mode
by Century ·
As I said I am getting 0x0E, 0x1E, 0x2E.
I am expecting 0x11 response.
Can you please guide me which software is good for TCP/IP communication testing.
RE: W5500 TCP Server Mode
by Eugeny ·
For Sn_IR?
Or for Sn_SR?
Please do not confuse the things because if you describe your issue improperly it will be close to impossible to help you.
If 0x2E is about Sn_IR, can you figur eout what have happened using datasheet page 49?
Why? Why do you think there could be no other response than this? Do you actually reset the flags?
RE: W5500 TCP Server Mode
by Century ·
Sorry for wrong direction, The response I am getting for Sn_IR.
Yes, Because the data is transmitting properly about 40 sec, sometimes about 10 sec.
But most of the time 0x01 response I will get for Sn_IR, Actually I am again setting the SEND_OK flag, but after if I read it will be 0x01.
RE: W5500 TCP Server Mode
by Eugeny ·
How do you “set” this flag (did I ask this question before?..)