W5500 UDP RX Socket Gives Weird Numbers
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 UDP RX Socket Gives Weird Numbers
by Eugeny ·
They may give any numbers but RSR must tell you how much data socket has received. What is their difference and value of RSR? May happen you have SPI access issue?
If you read this value and it is larger than buffer, then your register value read is defective.
Refer to datasheet on how to read the 16-bit register properly.
Some registers are not allowed to be written to. You must obey the algorithm.
Some are which? What W5500 board? Maybe these jumpers connect W5500 to power or to clock?
RE: RE: W5500 UDP RX Socket Gives Weird Numbers
by sugarcane41 ·
For now, I send packets from laptop to w5500.
Sn_RX_RSR has value of 39168.
Sn_RX_WR has value of 25977.
Sn_RX_RD has value of 872.
I read in a manner of:
In case this number might overflow, I took it as a unsigned long.
I also use the same manner to check my port number. It gives me 0 before initialization, and 5000 after that. Similarly, I read Sn_SR, which was 0 before initialization and 34 (decimal for SOCK_UDP) after that.
I also try to see if using RST would reset value for rx buffer, but it doesn’t work unless I manually write them to 0 in my code.
RE: W5500 UDP RX Socket Gives Weird Numbers
by sugarcane41 ·
Also I notice that when I send packets to w5500, I need to click send multiple times to send one with success.
Right now the way for checking incoming packet is:
I tried with both method mentioned in wiznet website, which are checking Sn_IR and Sn_RX_RSR. However both of them would not response to the very first sending packets. After I tried several times to send, Sn_RX_RSR would change to a large 5-digit number and start receiving weird message. Should I use other methods rather than the while loop to check the incoming packets? Will using interrupt function be a better choice?
RE: W5500 UDP RX Socket Gives Weird Numbers
by Eugeny ·
These values are wrong.
What are you reading here? Function
readRXBuffer(), according to its name, is designed to read RX buffer, and not W5500 register area? And then where did you get this type of code? Do you have link? Are you sure that compiler will optimize to read RD0 first, and RD1 second, and not otherwise?RE: W5500 UDP RX Socket Gives Weird Numbers
by sugarcane41 ·
This function read the RX Buffer of socket 0. From my understanding, Sn_RX_RD is the read pointer in RX buffer of Socket 0. I use an array to store bsb values, and the first parameter 1 mea ns choosing socket 0.
I also use this function to read the common registger area and it works. It reads the port number of 0 before initialization, and 5000 after that.
I write these code by myself, here is the detailed function:
In read5500 function, I take bsb<<3 for data phase since I am using VDM, and RW bit for writing is 0.
I really appreciate your help Mr.Eugeny. I searched my problems in this forum for a while and you always help everyone. Thanks again.
RE: W5500 UDP RX Socket Gives Weird Numbers
by Eugeny ·
You access RX buffer, not the socket 0 register set. There’s no RSR/RD/WR registers in that location. There’s RX RAM in there. This is a reason why you get nonsense.
RE: W5500 UDP RX Socket Gives Weird Numbers
by sugarcane41 ·
I have a question here. I am trying to read Sn_RX_RSR/Sn_RX_WR/Sn_RX_RD. Should we access to the socket directly, instead of selecting the rx buffer of this socket?
RE: W5500 UDP RX Socket Gives Weird Numbers
by Eugeny ·
Read the W5100 datasheet, you will find some more information about chip architecture there.
RX buffer receives data. TX buffer is to send data. Register space contains socket registers. Common register space contains common registers.