I did some more testing, this time with Linux to hopefully rule out the Windows comm port bug. Using my latest Teensy code, if I try sends of different size, I get:
Code:
Length of data received: 400000/400000
400000 words successfully received, 1.6 MBytes in 0.05 seconds (33.16MBPS)
Length of data received: 800000/800000
800000 words successfully received, 3.2 MBytes in 0.19 seconds (16.99MBPS)
Error, got only 2560 bytes, but expecting 4096, received 1034240 of 1040000 bytes total
Length of data received: 1034240/1040000
Error, data returned not as expected. 2496 data points of 1040000 are incorrect (0.240000%)
[1031744 1031745 1031746 ... 1034237 1034238 1034239]
1034240 words received, 4.13696 MBytes in 2.28 seconds (1.81MBPS)
Basically, sending 400,000 32bit words works great. 800,000 words drops the speed to half and 1,040,000 words gives data errors and a drop in speed. I used wireshark to look at the USB packets and to my unsophisticated eye, they look fine. The 400k words takes 45ms to send, 800k takes 100ms to send -- so about the same speed down the wire despite what I see in the python program. So that maybe implies the delay is now the USB, but the host side driver. The 1M word send takes 125ms to complete, which again is about 32MBPS and not the 1.8MBPS I see in my program.
So then I went back to my original firmware (attached in my first post) that uses 16bit words and for whatever reason does not have data corruption / dropped packets on Linux, but does show things slowing now. With that code, I see:
Code:
Length of data received: 400000/400000
400000 words successfully received, 0.8 MBytes in 0.02 seconds (32.71MBPS)
Length of data received: 800000/800000
800000 words successfully received, 1.6 MBytes in 0.07 seconds (22.10MBPS)
Length of data received: 3200000/3200000
3200000 words successfully received, 6.4 MBytes in 1.36 seconds (4.70MBPS)
So basically full speed, half speed and 1/10 speed in throughput. When I look at the USB packets then the USB transmit does match the time I see -- I'm seeing more 64 byte URB_BULK in packets between the 1088 byte URB_BULK in data packets and the transmit time drops.
Maybe someone can learn more the USB packets than I can, so they are attached in pcapng formap (Wireshark can open them). The files are:
LinuxUSB-400000-Good.pcapng -- 32bit words, 400k words, full speed
LinuxUSB-800000-Slow.pcapng -- 32bit words, 800k words, lower speed
LinuxUSB-1040000-Corrupt.pcapng -- 32bit words, 1040k words, dropped data and corruption
LinuxUSB-OrigCode-400000-Good.pcapng -- 16bit words, 400k words, full speed
LinuxUSB-OrigCode-800000-Slow.pcapng -- 16bit words, 800k words, lower speed
LinuxUSB-OrigCode-3200000-VerySlow.pcapng -- 16bit words, 3200k words, 1 tenth the speed
I zipped the files (bzip compression to fit) into 2 files -- one with the first 3 steps (32bit words, newer firmware code) and the other with 16bit words and the original firmware.