Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: PicoTCP lpc1768-picotcp-eth mbed-rtos mbed
Homepage
This project represents a the official UDP Tx speed Benchmark for the PicoTCP library.
The mbed board is sending 5 frames per milisecond (each frame has 1024 bytes of payload) to a linux host(directly connected).
Each time we send a packet, a counter is increased and sent to the receiver, so it can measure the number of packets that were lost during transmission.
The result:
20 seconds Tx Statistics
Total bytes received : 102404096
UDP Speed : 39.064 Mbit/s
Packet loss : 0.000000 %
The python script used (which you should rename it to PicoTCP_Official_UDP_Tx_Benchmark.py)
import socket
from struct import unpack
import fcntl, os
import errno
import random, string
from time import time, sleep
ECHO_SERVER_ADDRESS = "192.168.100.12"
NUMBER_OF_SECONDS = 20
LOCAL_SERVER_PORT = 2327
MEGA = 1024*1024.
LEN_PACKET = 1024
data = ''.join('\0' for _ in range(LEN_PACKET))
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM,socket.IPPROTO_UDP)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('', LOCAL_SERVER_PORT))
print "Started receiving data...."
print "Time : %d " % time()
while True:
start = time()
counter = 0
size = 0
lost_packets = 0
index = -1
while start + NUMBER_OF_SECONDS > time():
data, addr = s.recvfrom(LEN_PACKET)
counter+=1
size += len(data)
_index = unpack("<I",data[:4])
if _index[0] > 0 and index > 0:
lost_packets += _index[0] - index -1
index = _index[0]
print "20 seconds Tx Statistics"
print "Total bytes received : %d" % size
print "UDP Speed : %.3f Mbit/s" % ((size*8.)/(MEGA * NUMBER_OF_SECONDS))
print "Packet loss : %.6f %%" % (100. * lost_packets/(lost_packets+counter))
This test is based on the following libraries
Import librarylpc1768-picotcp-eth
A PicoTCP driver for the lpc1768 mbed board
Import libraryPicoTCP
Free (GPLv2) TCP/IP stack developed by TASS Belgium
Import librarymbed-rtos
Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.
