Why not have a variable which can be set by the user.
I don't know call it SerialUartSpeed, let's say with a value from 0..255.
At 255 (default) the Serial Usb goes at it's fastest as at the moment.
It is slowed down dependent upon the value of SerialUartSpeed right down to let's say 12mb/s for a value of 0.
Alternatively you could call it SerialUartThrottle, with 0 (default) being the fastest and 255 being the slowest speed.
Hm. Not tried - does it help to just make the timer slower? (That would be the perfect place to create a variable speed - IF that works)
Tim? Can you test?
edit:
It would be a opportunity to add different timouts, perhaps.. (see the "todo")
Code:// TODO: should be 2 different timeouts, high speed (480) vs full speed (12) #define TRANSMIT_FLUSH_TIMEOUT 75 /* in microseconds */
But again, I have no idea if that is enough. I'd try a pretty high value first, to confirm..
Nothing. If you read the my following post: I said it will not help.@FrankB - quick - look not sure what to do with the current value of 75?
Nothing. If you read the my following post: I said it will not help.
Better get your roof doneThat's more important.
Why not have a variable which can be set by the user.
I have a couple ideas about possible ways to detect if the USB host is (very likely) Windows. Will explore after I've merged audio stuff, which is after bootloader stuff I'm doing now, and somewhere squeezing in some time to play with MTP / MSC / FS.
C:\T_Drive\tCode\pjrc_latency_test\FB_SerTest>SerialTest2 COM7 SZ38
Port: COM7
After start, you'll probably see some garbage. Things will normalize after a few seconds.
[B]Waiting...First discard 115353600 Bytes. Discarded 230752256 total Bytes.[/B]
Start.
X_Lines-Delta: 26227 ::52 bytes Received: 3803648, B in, 199358, us = ,152.64, Mbps: 1411FC00
.
Lines-Delta: 100096. Received: 3803648, B in, 130103, us = ,233.89, Mbps: 14138300
stats: 100K=1 less=0 repeated 0 rmax=2000000
..............
X_Lines-Delta: 42587 ::40 bytes Received: 14298B5B<6<<<>>>___[[[]]]---{{{}}}___!
X_Lines-Delta: 57481 ::52 bytes Received: 3803648, B in, 138622, us = ,219.51, Mbps: 142A6C00
unsigned long rr=0;
do {
r = read_port(port, buf, sizeof buf);
rr+=r;
} while ( r > sizeof(buf) -1500);
printf("First discard %lu Bytes.\t", rr );
do {
r = read_port(port, buf, sizeof buf);
rr+=r;
} while ( r > sizeof(buf) -100);
printf("Discarded %lu total Bytes.\n", rr );
Waiting...First discard 22970368 Bytes. Discarded 1623267328 total Bytes.
and
Waiting...First discard 694393344 Bytes. Discarded 1192507904 total Bytes.
...
00:38:53.165 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
00:38:53.167 (ports 2): nothing new, skipping HID & Ports enum
[U]08:04:32.621[/U] (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:04:32.623 (ports 2): nothing new, skipping HID & Ports enum
08:04:33.387 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:04:33.388 (ports 2): nothing new, skipping HID & Ports enum
08:04:33.497 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:04:33.499 (ports 2): nothing new, skipping HID & Ports enum
08:04:33.791 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:04:33.793 (ports 2): nothing new, skipping HID & Ports enum
08:05:00.568 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:05:00.569 (ports 2): nothing new, skipping HID & Ports enum
08:05:00.899 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:05:00.900 (ports 2): nothing new, skipping HID & Ports enum
08:05:01.229 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:05:01.230 (ports 2): nothing new, skipping HID & Ports enum
08:05:16.283 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:05:16.284 (ports 2): nothing new, skipping HID & Ports enum
[U]08:27:08.070[/U] (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:27:08.072 (ports 2): nothing new, skipping HID & Ports enum
[U]08:43:42.807[/U] (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:43:42.809 (ports 2): nothing new, skipping HID & Ports enum
08:43:43.693 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:43:43.694 (ports 2): nothing new, skipping HID & Ports enum
08:43:43.803 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:43:43.804 (ports 2): nothing new, skipping HID & Ports enum
08:43:43.918 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:43:43.919 (ports 2): nothing new, skipping HID & Ports enum
08:44:26.601 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:44:26.602 (ports 2): nothing new, skipping HID & Ports enum