http://www.pjrc.com/teensy/benchmark_us ... ceive.html
Using the same host harness (on Ubuntu laptop), I used the following pyboard program to measure latency
Code: Select all
# from teensy latency_test /dev/ttyACM0
import pyb
usb_vcp = pyb.USB_VCP()
pyb.LED(1).on()
pyb.delay(5000)
# wait for host to connect to ACM0
while not usb_vcp.isconnected():
pass
pyb.LED(1).off()
while True:
if usb_vcp.any() :
x = usb_vcp.read(1)
if x == b'x' :
usb_vcp.write('0')
usb_vcp.write('1')
usb_vcp.write('2')
usb_vcp.write('x')
Code: Select all
teensy 3.1 UNO pyboard
latency @ 1 bytes: 0.10 ms 4.09 ms 10.00 ms
latency @ 2 bytes: 0.10 ms 4.09 ms 10.00 ms
latency @ 12 bytes: 0.10 ms 4.09 ms 10.00 ms
latency @ 30 bytes: 0.14 ms 4.09 ms 10.00 ms
latency @ 62 bytes: 0.19 ms 8.19 ms 10.00 ms
latency @ 71 bytes: 0.21 ms 8.19 ms 10.00 ms
latency @ 128 bytes: 0.26 ms 12.28 ms 10.00 ms
latency @ 500 bytes: 0.64 ms 45.05 ms 20.00 ms
latency @ 1000 bytes: 1.07 ms 86.01 ms ?
latency @ 2000 bytes: 2.03 ms 172.04 ms ?
latency @ 4000 bytes: 3.88 ms 344.07 ms ?
latency @ 8000 bytes: 7.45 ms 684.04 ms ?
Code: Select all
# from teensy latency_test /dev/ttyACM0 TODO ??
# recv is blocking, read is not
import pyb
usb_vcp = pyb.USB_VCP()
pyb.LED(1).on()
pyb.delay(5000)
# wait for host to connect to ACM0
while not usb_vcp.isconnected():
pass
pyb.LED(1).off()
while True:
x = usb_vcp.recv(500)
readbytes on teensy 3.1 averages 1,150,244 bytes/second, on UNO average is 11,761 bytes/sec.
EDIT: if I change the host send size from 30000 to 512, then the pyboard does do some recv's -- though not 1 million bytes worth.