AnsweredAssumed Answered

Intermittent Missing Packet on Send-or-Receive

Question asked by Eric Koski on May 30, 2017

Hi, I am creating a psuedo IOT system.  The issue I have is that periodically, my server seems to send data, but my clients don't ever receive it.  For communication going to my PC, I can see the packet on Wireshark (and it appears to be a valid packet), but the client never receives it and eventually times out.  The issue can arise almost immediately in one session, or not show up for 5 minutes in a different session.


I have a couple of NXP K66F Freedom boards that I am using for the system.  I am currently using the KDS v3 with SDK2.0 for development.  The communication is based on the CoAP protocol running over the LWIP library.  My version of LWIP is 1.4.1.  For CoAP, I am using microcoap for both the client and server roles.  Microcoap is designed as a server-only implementation, but for basic CoAP communication, I can easily create a client coap packet with microcoap by using a rolling token and message ID and using non-confirmable requests.


My current system design has one NXP set up as the server and connected to a switch.  A second NXP is set up as a client and also connected to the same switch.  A third NXP is set up as a "different" client and connected to the same switch.  Finally, my PC runs a Java application using Californium (for CoAP) as yet another client.


The clients drive the communication and communicate regularly at 50 ms.  Having more clients communicating typically causes the issue to occur more quickly, which might imply resource contention.  However, I can see the issue occurring with only one client if I wait long enough.


With the switch, I cannot use Wireshark to snoop communication between the NXP's.  However I can use Wireshark to view the communication between the NXP-server and the PC.  The PC-client and the NXP-clients have a "receive-timeout", and so I can assume for now that the issue is the same.  On the PC side, I can see the CoAP packet within Wireshark, and I can go byte-by-byte to see that the CoAP portion of the IP packet is valid.  However, the Californium UDP connector never "sees" the packet.


This leads me to think that some portion of the IP packet coming from the NXP Server may be invalid.  This points to LWIP, since it handles all of the underlying "packet creation" via lwip_send().  My main question is, has anyone else seen anything similar?  LWIP seems to be able to create the packets correctly, since I only see the problem intermittently.  And for the packet that fails, the CoAP portion is valid.  A follow-up question might be, has anyone used other light IP stacks on the NXP that might work better than LWIP?


Thank you for reading my post and any help that you might have to offer!