there is a code that checks a time out in function sendto() and when it can’t reach some node it trys to resend (inside the chip) and gives a delay which can be configured like this:
so my questions are
- Does the chip issues an ARP request (but I don’t see it on wire shark)or something else on every sentto() which checks the remote node online?
- default delay is set to 0.2 sec x 8 -and it gives a 1.6 sec delay. before SOCKERR_TIMEOUT… can I use 2ms and 2 trys (it works but not shure what affects to)?
- Or how to avoid this big delay when sending to offline node?
sendto() -delay fragment
tmp = getSn_IR(sn);
if(tmp & Sn_IR_SENDOK)
//else if(tmp & Sn_IR_TIMEOUT) return SOCKERR_TIMEOUT;
else if(tmp & Sn_IR_TIMEOUT)
I found only partial answer, but how to get mac address of remote node…
Valid only in UDP mode.
The basic operation is sa
me as SEND. Normally SEND transmits data
after destination hardware address is acquired by the automatic ARP
-process(Address Resolution Protocol). But SEND_MAC transmits data
without the automatic ARP-process. In this case, the destination
is acquired from Sn_DHAR configured by host,
instead of APR -process.
ARP Request is a message for getting a MAC address. In UDP communication, arp is transmitted only once before sending the first data. This is because you don’t need to send more arp after knowing MAC address. Afterwards, it is sent only when you change the Destination IP Address. You can set retry time and retry count to 2ms and 2try. But if you set it to 2ms and 8try, it’s not a 1.6s delay. If the arp response isn’t received in 1.6 seconds, a timeout occurs, not a delay of 1.6 seconds. Upon receipt of the arp response, the next action is taken without delay.
Thank you, but what do you mean -“But if you set it to 2ms and 8try, it’s not a 1.6s delay”?
Is it any way to get incoming mac adress in udp ?
Or get acces to arp cache ?
Or issue an arp request and get the mac out of it?
And when we have unseccesful send to offline node does the arp cache cleare?
First of all, you did not state which protocol you use. TCP and UDP work slightly differently.
@becky answered the question - W5500 sends ARP request only once, before first communication. And it will update MAC address with another ARP request if you change destination IP address of the socket.
Please refer to the datasheet, it has nice complex formula. Each attempt (try) timeout value doubles up to 65535.
W5500 does not have ARP cache. It has storage for current IP address.
I do not think so. You normally do not need MAC address, but if you choose to send to specific MAC address, you use SEND_MAC command (as you already noticed).
Can you please explain your actual problem? I am afraid it is going to become XY problem if you will not do it.
Thank you for reply!
My particular problem - I’m using Steeve Karg BACnet stack (UDP protocol) and until I was trying to implement P2P every thing were ok. But I got a very long function blocking time when sendto() trying to send to offline node -controller is the initiator of message. And I’m sendind to many nodes via one socket.
If can get a mac I can avoid arp which block function and send directly.
But where I can get incoming mac or create my own arp?
In conclusion - I need to send recive to/from different ip’s from one socket by UDP protocol.