Hi all,
This post is, in some sense, a continuation of Measuring Arduino's FT232 throughput rate ?. I'm on Ubuntu Linux as described on that thread.
Well, I just tried the Uno, and had to post back...
I must say - I love that they replaced the FT232 with something more open - as now, in principle, one should be able to program the Atmega8U2 for different USB behaviors. Although, I do not particularly like that the part is so small, it doesn't look solderable by hand (maybe only with hot air gun - but even then, it will be a challenge to hold those ultrasmall pins in place).
Unfortunately, it seems that the default edition - for now - can not support speeds up to 2 Mbps, not even close.
First of all, I'm using the exact same procedure/code as in Measuring Arduino's FT232 throughput rate ? Reply #28. Some of the differences between UNO and Duemillanove are:
- Device is no longer
/dev/ttyUSB0
- now it is/dev/ttyACM0
- The driver in Linux is no longer
ftdi-sio
- now it isusbcore
- Using Arduino 0021 to program the Uno
- The Uno will not need an extra capacitor between RESET and GND just for the sake of it being programmed by the IDE; however any other sort of serial access by other programs (
stty
,writeread_bonus
) again resets the Uno - so I again had to add the capacitor to run the loopback test.
Here is a code snippet which shows some data about the Uno, and then shows the result of running writeread_bonus
:
$ lsusb # not much shown
Bus 005 Device 005: ID 2341:0001
$ find /sys/devices/pci0000\:00/ -name '*tty*'
/sys/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/tty
/sys/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/tty/ttyACM0
$ for ix in $(find /sys/devices/pci0000:00/0000:00:1d.3/usb5/5-2 -type f); do echo "$(basename $ix):" ; cat $ix ; done
...
idVendor:
2341
idProduct:
0001
...
manufacturer:
Arduino (www.arduino.cc)
product:
Arduino Uno
serial:
649383233313513181C0
...
uevent:
MAJOR=166
MINOR=0
DEVNAME=ttyACM0
$ stty 2000000 inpck -ixon -icanon -hupcl -isig -iexten -echok -echoctl -echoke min 0 -crtscts </dev/ttyACM0
$ ./writeread_bonus /dev/ttyACM0 2000000 ./ttester 3>myout.txt
stdalt opened; Alternative file descriptor: 3
Opening port /dev/ttyACM0;
Got speed 2000000 (4107/0x100b);
Got file/string './ttester'; opened as file (102400).
write_thread_function spawned
EAG: 0, WR: 1, WF: 0, read: 102400, FRD: 59, TOU: 14080, OBS: 18944, RB/s: 14622.06, WB/s: 13019.38
+++DONE+++
Wrote: 102400 bytes; Read: 102400 bytes; Total: 204800 bytes.
Start: 1286748859 s -251915 us; End: 1286748861 s 708822 us; Delta: 2 s 960737 us.
2000000 baud for 8N1 is 200000 Bps (bytes/sec).
Measured: write 34585.98 Bps (17.29%), read 34585.98 Bps (17.29%), total 69171.97 Bps.
Notice that - in spite of write gauging (done in respect to 2 Mbps, though) - the writeread_bonus
program still detected an output buffer size of 18944 bytes (this number can, however, change between runs); and the effective speed settled at some 34 KBytes/s (some 17% of requested 2 Mbps).
I'm not sure if this is due to:
- hardware (whether Atmega8U2 can at all support USB->serial at 2Mbps purely electrically), or
- a limitation of the current firmware on the Atmega8U2, or
- a limitation of the
usbcore
driver
If this is a limitation due to firmware or driver, I believe that it opens a very interesting topic for discussion - as then it is in principle possible to achieve 2 Mbps also with the Atmega8U2, as with the FT232 Which is why, I thought the case of the UNO/Atmega8U2 throughput merits its own thread
Well, I'd love to hear any responses on this,
Thanks,
Cheers!