# UDP/IP FreeRTOS\_sendto sends Packets 5 times

**URL:** <https://forums.freertos.org/t/udp-ip-freertos-sendto-sends-packets-5-times/585>\
**Category:** Kernel\
**Created:** [March 25, 2013, 8:16pm UTC](https://forums.freertos.org/t/udp-ip-freertos-sendto-sends-packets-5-times/585 "2013-03-25T20:16:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 25, 2013, 8:16pm UTC](https://forums.freertos.org/t/udp-ip-freertos-sendto-sends-packets-5-times/585/1 "2013-03-25T20:16:44Z")

</div>

**[hisdudeness23](https://sourceforge.net/u/hisdudeness23/)** wrote on [Monday, March 25, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/13bd0a8d/#0f00):

I use a LPC1769 MCU with the FreeRTOS UDP/IP stack. I think I have ported the drivers correctly. I use the Standard Implementations (not the Zero Copy types).  
Everytime I use the **FreeRTOS\_sendto()** function, the packets are sent 5 times.  
When I do a ping from a Linux machine, I get one normal answer-packet and 4 additional ( **DUP!** )-Packets.

I have used the same code on the raspberry pi with the standard Linux-Berkeley-Sockets implementation and it works perfectly.

I will do some digging tonight, to localize the problem. But maybe somebody has experienced the same or a similar problem?

Thanks in advance for an answer!

The Dude.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 25, 2013, 8:36pm UTC](https://forums.freertos.org/t/udp-ip-freertos-sendto-sends-packets-5-times/585/2 "2013-03-25T20:36:51Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, March 25, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/13bd0a8d/#1c79):

I would concentrate your initial investigation in the driver layer - for example, is there a DMA which is sending the same packet multiple times because there is an error in the descriptor configuration (maybe the last packet is not marked as such in the descriptor)?&nbsp;

I would suggest counting how many times the xNetworkInterfaceOutput() function gets called compared to how many packets you see on the wire.&nbsp; That will allow us to narrow down where to look.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 25, 2013, 8:40pm UTC](https://forums.freertos.org/t/udp-ip-freertos-sendto-sends-packets-5-times/585/3 "2013-03-25T20:40:55Z")

</div>

**[hisdudeness23](https://sourceforge.net/u/hisdudeness23/)** wrote on [Monday, March 25, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/13bd0a8d/#0a6c):

Thank you very much Mr. Barry,

I will do that right now and I will post the result.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 25, 2013, 8:53pm UTC](https://forums.freertos.org/t/udp-ip-freertos-sendto-sends-packets-5-times/585/4 "2013-03-25T20:53:56Z")

</div>

**[hisdudeness23](https://sourceforge.net/u/hisdudeness23/)** wrote on [Monday, March 25, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/13bd0a8d/#6e82):

Dear Mr. Barry,

the Number of xNetworkInterfaceOutput() function-calls matches the number of my FreeRTOS\_sendto calls and the ratio of the number of packets on the wire and the sendto calls is 5:1, so I think you were right, Sir. The problem should be within the driver layer.

Thank you very much for your help!

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 25, 2013, 9:14pm UTC](https://forums.freertos.org/t/udp-ip-freertos-sendto-sends-packets-5-times/585/5 "2013-03-25T21:14:38Z")

</div>

**[hisdudeness23](https://sourceforge.net/u/hisdudeness23/)** wrote on [Monday, March 25, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/13bd0a8d/#8d61):

Problem solved!

The SendData() function had no break condition in the for-loop in a successful case. netifMAX\_TX\_ATTEMPTS was set to 5, so the packet was sent 5 times.

Thanks again Mr. Barry!  
And sorry for interrupting your talk to the guy from i-sysem on the Embedded World. I was that dude, who asked all the questions about the UDP-IP Stack. I hope I didn’t have messed it up for you.

Best Regards,  
The Dude.
