Could the speed be tied to F_BUS_ACTUAL since that doesn't increase with the CPU speed like in previous versions?
In other news, with the new fixes I can now ping up to 8184 bytes which is the max the terminal lets me send so at least that works now.
T:\T_Downloads\PSTools>ping 192.168.0.23 -n 10 -l 8192
Pinging 192.168.0.23 with 8192 bytes of data:
Reply from 192.168.0.23: bytes=8192 time=6ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=6ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=7ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=6ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=6ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=6ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=6ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=6ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=6ms TTL=64
Reply from 192.168.0.23: bytes=8192 time=7ms TTL=64
T:\T_Downloads\PSTools>ping 192.168.0.23 -n 2 -l 10210
Pinging 192.168.0.23 with 10210 bytes of data:
Reply from 192.168.0.23: bytes=10210 time=7ms TTL=64
Reply from 192.168.0.23: bytes=10210 time=8ms TTL=64
05:25:52.546 -> rx_data(asix): 1520
05:25:52.546 -> rx_data(asix): 1520
05:25:52.546 -> rx_data(asix): 1520
05:25:52.546 -> rx_data(asix): 1520
05:25:52.546 -> rx_data(asix): 1520
05:25:52.546 -> tx_data(asix): 1518
05:25:52.546 -> tx_data(asix): 1518
05:25:52.546 -> tx_data(asix): 1518
05:25:52.546 -> tx_data(asix): 1518
05:25:52.546 -> tx_data(asix): 1518
I can't tell where latency is being introduced, based on the timestamps in the serial monitor ping replies are being queued at least within the same millisecond as receiving them so something isn't adding up somewhere.
...
I'm not sure how wwatson's MSC driver is able to wait until the data transfer completes, if I try to do it the same way he did it just locks forever and never frees up. Essentially I will have to have a way to do this because UDP messages get sent so fast that it fills up all my buffers before the first one is even sent, it won't make a difference for TCP, but UDP is losing messages because of it.
17:03:38.379 -> Starting benchtx...
17:03:38.379 -> Benchmark client started.
17:03:38.379 -> Protocol: TCP
17:03:38.379 -> Remote IP Addr: 192.168.0.55
17:03:38.379 -> Remote Port: 7007
17:03:38.379 -> Message Size: 65536
17:03:38.379 -> Num. of messages: 100
17:03:38.379 ->
17:03:39.512 -> Megabytes: 6.553600 Seconds: 0.9850 KBits/Sec: 53227.2081
17:03:41.292 -> Starting benchtx...
17:03:41.292 -> Benchmark client started.
17:03:41.292 -> Protocol: TCP
17:03:41.292 -> Remote IP Addr: 192.168.0.55
17:03:41.292 -> Remote Port: 7007
17:03:41.292 -> Message Size: 65536
17:03:41.292 -> Num. of messages: 100
17:03:41.292 ->
17:03:42.345 -> Megabytes: 6.553600 Seconds: 1.0160 KBits/Sec: 51603.1496
Ok so like I've said before, bigger buffers = more speed
...
I'm not sure how wwatson's MSC driver is able to wait until the data transfer completes, if I try to do it the same way he did it just locks forever and never frees up. Essentially I will have to have a way to do this because UDP messages get sent so fast that it fills up all my buffers before the first one is even sent, it won't make a difference for TCP, but UDP is losing messages because of it.
USB Host InputFunctions example
USB Ready
Test logger_RawWrite
uSDFS_VER:30_Jun_19_07_17
BUFFSIZE :8192
Dev Type :2:/
File System FS_FAT32
Free Disk Size 1740204 clusters
Cluster Size 16 sectors
Sector Size 512 bytes
Change drive
A_00001.dat
stat FR_NO_FILE 0
opened FR_OK 0
Mutex initialized: 0
Mutex initialized: 1
TCP/IP stack initialization is done.
SetMACAddress: 0050B6BE8BB4
MulticastJoin: 333300000001
MulticastTable:
0
0
10000000
0
0
0
0
0
MulticastJoin: 3333FFE1815E
MulticastTable:
0
0
10000000
0
0
0
0
10000
netif Initialized
Initializing DHCP
DHCP initialization done!
IPAddress: 0.0.0.0
SubnetMask: 0.0.0.0
Gateway: 0.0.0.0
DHCPServer: 0.0.0.0
State: 2
IPAddress: 192.168.0.103
SubnetMask: 255.255.255.0
Gateway: 192.168.0.1
DHCPServer: 192.168.0.1
State: 5
................................................................
.................................... (1453501006 - 0.022544 MB/s)
(open: 290992 us; close: 4096000 us; write: min,max: 11985 10134972 us)
openDir FR_OK
A_00001.dat 32768000 2019-10-07 14:58:34
unmount FR_OK
USB Host InputFunctions example
Test logger_RawWrite
uSDFS_VER:30_Jun_19_07_17
BUFFSIZE :8192
Dev Type :2:/
File System FS_FAT32
Free Disk Size 1736204 clusters
Cluster Size 16 sectors
Sector Size 512 bytes
Change drive
USB Ready
A_00001.dat
stat FR_OK 0
opened FR_OK 0
................................................................
.................................... (13234998 - 2.475860 MB/s)
(open: 361992 us; close: 33000 us; write: min,max: 11979 68980 us)
openDir FR_OK
A_00001.dat 32768000 2019-10-07 15:14:14
unmount FR_OK
I think it’s the way you lock MSC while waiting for the USB transfer to complete, it appears to me like it only triggers if the previous transfer wasn’t complete before it sends the next one out. Which probably works fine with the other host drivers because they aren’t queuing as much data as mine does so the while loop never triggers. I don’t think the while loop works as you intended it to because when I try to implement the same while loop to wait for a transfer to complete the driver locks up and never returns.
00:37:26.214 -> Starting benchtx...
00:37:26.214 -> Benchmark client started.
00:37:26.214 -> Protocol: TCP
00:37:26.214 -> Remote IP Addr: 192.168.0.55
00:37:26.214 -> Remote Port: 7007
00:37:26.214 -> Message Size: 32374
00:37:26.214 -> Num. of messages: 100
00:37:26.214 ->
00:37:27.059 -> Megabytes: 3.237400 Seconds: 0.7860 KBits/Sec: 32950.6361
00:37:31.553 -> Starting benchtx...
00:37:31.553 -> Benchmark client started.
00:37:31.553 -> Protocol: TCP
00:37:31.553 -> Remote IP Addr: 192.168.0.55
00:37:31.553 -> Remote Port: 7007
00:37:31.553 -> Message Size: 32374
00:37:31.553 -> Num. of messages: 1000
00:37:31.553 ->
00:37:38.341 -> Megabytes: 32.374000 Seconds: 6.7860 KBits/Sec: 38165.6351
00:37:56.934 -> Starting benchtx...
00:37:56.934 -> Benchmark client started.
00:37:56.934 -> Protocol: TCP
00:37:56.934 -> Remote IP Addr: 192.168.0.55
00:37:56.934 -> Remote Port: 7007
00:37:56.934 -> Message Size: 32374
00:37:56.934 -> Num. of messages: 10000
00:37:56.934 ->
00:39:09.037 -> Megabytes: 323.740000 Seconds: 68.8560 KBits/Sec: 37613.5703
Ok so I added an experimental method that seems to kind of work,
...
Megabytes: 0.204800 Seconds: 0.1740 KBits/Sec: 9416.0920
Megabytes: 0.204800 Seconds: 0.1860 KBits/Sec: 8808.6022
Megabytes: 0.204800 Seconds: 0.1920 KBits/Sec: 8533.3333
Megabytes: 0.204800 Seconds: 0.1980 KBits/Sec: 8274.7475
Megabytes: 2.048000 Seconds: 1.7040 KBits/Sec: 9615.0235
Megabytes: 2.048000 Seconds: 1.7340 KBits/Sec: 9448.6736
Megabytes: 2.048000 Seconds: 1.7400 KBits/Sec: 9416.0920
Megabytes: 2.048000 Seconds: 1.7640 KBits/Sec: 9287.9819
Udp 192.168.0.5 1.282 2,048,000 12,779.298
Udp 192.168.0.5 1.290 2,048,000 12,698.626
Udp 192.168.0.5 1.256 2,048,000 13,044.073
Udp 192.168.0.5 1.265 2,048,000 12,952.063
Tcp 192.168.0.5 1.638 2,048,000 10,000.988
Tcp 192.168.0.5 1.622 2,048,000 10,098.005
Tcp 192.168.0.5 1.627 2,048,000 10,068.497
Tcp 192.168.0.5 1.629 2,048,000 10,059.992
USB Host InputFunctions example
USB Ready
[COLOR="#FF0000"] F_CPU=912000000 deg C=54[/COLOR]
Looped: 1 LoopedUSB: 3507 LinkSpeed: 10BASE
Looped: 1 LoopedUSB: 0 LinkSpeed: 10BASE
Looped: 6243687 LoopedUSB: 1680 LinkSpeed: 10BASE
Mutex initialized: 0
Mutex initialized: 1
TCP/IP stack initialization is done.
SetMACAddress: 0050B6BE8BB4
MulticastJoin: 333300000001
MulticastTable:
0
0
10000000
0
0
0
0
0
MulticastJoin: 3333FFE225AB
MulticastTable:
0
0
10000000
0
0
0
0
100000
netif Initialized
Initializing DHCP
DHCP initialization done!
IPAddress: 0.0.0.0
SubnetMask: 0.0.0.0
Gateway: 0.0.0.0
DHCPServer: 0.0.0.0
State: 2
IPAddress: 192.168.0.8
SubnetMask: 255.255.255.0
Gateway: 192.168.0.1
DHCPServer: 192.168.0.1
State: 5
Looped: 12670374 LoopedUSB: 3507 FNETMemFree: 64656 LinkSpeed: 100BASE
Looped: 12472042 LoopedUSB: 3486 FNETMemFree: 64656 LinkSpeed: 100BASE
setup(){
…
setHandleIsConnected(handleIsConnected);
#if defined(__IMXRT1062__)
Serial.printf("\n F_CPU=%u", F_CPU_ACTUAL );
Serial.printf( "\tdeg C=%u\n" , (uint32_t)tempmonGetTemp() );
#endif
[COLOR="#FF0000"][B] delay ( 1000 );[/B][/COLOR]
}
void usbthread() {
uint32_t cc = 0;
while(1) {
myusb.Task();
asix1.read();
checkLink();
if(fnet_netif_is_initialized(current_netif)){
fnet_poll();
fnet_service_poll();
}
#ifdef STATS
LoopedUSB++;
#endif
#ifdef HACKED
cc++;
[COLOR="#FF0000"] if ( cc > 2000 ) {
[/COLOR] cc=1980;
threads.yield();
}
#endif
}
}
Likely it’s getting caught up somewhere in the initialization phase when it has to send all the queue controls one after the other, if you turn on the USBHOST_PRINT_DEBUG in the USBHost_t36.h file you can see at what point it fails and that should give some insight. I don’t have any heat sinks or I would test at the higher speeds.
USB Host InputFunctions example
USB2 PLL running
reset waited 6
USBHS_ASYNCLISTADDR = 0
USBHS_PERIODICLISTBASE = 2003B000
periodictable = 2003B000
USB Ready
port change: 10001803
connect
F_CPU=960000000 deg C=62
Looped: 1 LoopedUSB: 0 LinkSpeed: 10BASE deg C=62
begin reset
port change: 18001205
port enabled
end recovery
new_Device: 480 Mbit/sec
new_Pipe
enumeration:
enumeration:
enumeration:
Device Descriptor:
12 01 00 02 FF FF 00 40 95 0B 2B 77 01 00 01 02 03 01
VendorID = 0B95, ProductID = 772B, Version = 0001
Class/Subclass/Protocol = 255 / 255 / 0
Number of Configurations = 1
enumeration:
enumeration:
Manufacturer: ASIX Elec. Corp.
enumeration:
Product: AX88772B
enumeration:
Serial Number: E225AB
enumeration:
Config data length = 39
enumeration:
Configuration Descriptor:
09 02 27 00 01 01 04 A0 64
NumInterfaces = 1
ConfigurationValue = 1
09 04 00 00 03 FF FF 00 07
Interface = 0
Number of endpoints = 3
Class/Subclass/Protocol = 255 / 255 / 0
07 05 81 03 08 00 0B
Endpoint = 1 IN
Type = Interrupt
Max Size = 8
Polling Interval = 11
07 05 82 02 00 02 00
Endpoint = 2 IN
Type = Bulk
Max Size = 512
Polling Interval = 0
07 05 03 02 00 02 00
Endpoint = 3 OUT
Type = Bulk
Max Size = 512
Polling Interval = 0
enumeration:
USBHub memory usage = 960
USBHub claim_device this=20002E00
USBHub memory usage = 960
USBHub claim_device this=20002A20
Descriptor 4 = INTERFACE
ASIXEthernet claim this=200031E0
type=1
vid=B95, pid=772B, bDeviceClass = 255, bDeviceSubClass = 255, bDeviceProtocol = 0
numEndpoints=3
interrupt_size = 8
interrupt_ep = 129
interrupt_interval = 11
rx_size = 512
rx_ep = 130
rx_interval = 0
tx_size = 512
tx_ep = 3
tx_interval = 0
new_Pipe
new_Pipe
new_Pipe
allocate_interrupt_pipe_bandwidth
ep interval = 11
interval = 256
best_bandwidth = 3, at offset = 0
[COLOR="#FF0000"]Control - ASIX...
Descriptor 5 = ENDPOINT
Descriptor 5 = ENDPOINT
Descriptor 5 = ENDPOINT[/COLOR]
Looped: 6661980 LoopedUSB: 3660 LinkSpeed: 10BASE deg C=63
Looped: 12289359 LoopedUSB: 3507 LinkSpeed: 10BASE deg C=64
Looped: 12289361 LoopedUSB: 3507 LinkSpeed: 10BASE deg C=64
Looped: 12289409 LoopedUSB: 3486 LinkSpeed: 10BASE deg C=64
Looped: 12289368 LoopedUSB: 3507 LinkSpeed: 10BASE deg C=65
Looped: 12289361 LoopedUSB: 3507 LinkSpeed: 10BASE deg C=65
Looped: 12289273 LoopedUSB: 3486 LinkSpeed: 10BASE deg C=65
Looped: 12289363 LoopedUSB: 3507 LinkSpeed: 10BASE deg C=65
Looped: 12289245 LoopedUSB: 3507 LinkSpeed: 10BASE deg C=65
Looped: 12289392 LoopedUSB: 3486 LinkSpeed: 10BASE deg C=65
Looped: 12289253 LoopedUSB: 3507 LinkSpeed: 10BASE deg C=66
Looped: 12289357 LoopedUSB: 3507 LinkSpeed: 10BASE deg C=66
USB Host InputFunctions example
USB2 PLL running
reset waited 6
USBHS_ASYNCLISTADDR = 0
USBHS_PERIODICLISTBASE = 2003B000
periodictable = 2003B000
USB Ready
port change: 10001803
connect
F_CPU=912000000 deg C=57
begin reset
port change: 18001205
port enabled
end recovery
new_Device: 480 Mbit/sec
new_Pipe
enumeration:
enumeration:
enumeration:
Device Descriptor:
12 01 00 02 FF FF 00 40 95 0B 2B 77 01 00 01 02 03 01
VendorID = 0B95, ProductID = 772B, Version = 0001
Class/Subclass/Protocol = 255 / 255 / 0
Number of Configurations = 1
enumeration:
enumeration:
Manufacturer: ASIX Elec. Corp.
enumeration:
Product: AX88772B
enumeration:
Serial Number: E225AB
enumeration:
Config data length = 39
enumeration:
Configuration Descriptor:
09 02 27 00 01 01 04 A0 64
NumInterfaces = 1
ConfigurationValue = 1
09 04 00 00 03 FF FF 00 07
Interface = 0
Number of endpoints = 3
Class/Subclass/Protocol = 255 / 255 / 0
07 05 81 03 08 00 0B
Endpoint = 1 IN
Type = Interrupt
Max Size = 8
Polling Interval = 11
07 05 82 02 00 02 00
Endpoint = 2 IN
Type = Bulk
Max Size = 512
Polling Interval = 0
07 05 03 02 00 02 00
Endpoint = 3 OUT
Type = Bulk
Max Size = 512
Polling Interval = 0
enumeration:
USBHub memory usage = 960
USBHub claim_device this=20002E00
USBHub memory usage = 960
USBHub claim_device this=20002A20
Descriptor 4 = INTERFACE
ASIXEthernet claim this=200031E0
type=1
vid=B95, pid=772B, bDeviceClass = 255, bDeviceSubClass = 255, bDeviceProtocol = 0
numEndpoints=3
interrupt_size = 8
interrupt_ep = 129
interrupt_interval = 11
rx_size = 512
rx_ep = 130
rx_interval = 0
tx_size = 512
tx_ep = 3
tx_interval = 0
new_Pipe
new_Pipe
new_Pipe
allocate_interrupt_pipe_bandwidth
ep interval = 11
interval = 256
best_bandwidth = 3, at offset = 0
[COLOR="#FF0000"]Control - ASIX...
Descriptor 5 = ENDPOINT
Descriptor 5 = ENDPOINT
Descriptor 5 = ENDPOINT[/COLOR]
control callback (asix) 1
Done
control callback (asix) 2
Done
control callback (asix) 3
nodeID: 00 50 B6 E2 25 AB
control callback (asix) 4
Done
control callback (asix) 5
Done
control callback (asix) 6
Done
control callback (asix) 7
Done
control callback (asix) 8
Done
control callback (asix) 9
Done
control callback (asix) 10
Done
control callback (asix) 11
Done
control callback (asix) 12
Done
control callback (asix) 13
Done
control callback (asix) 14
Done
control callback (asix) 15
Done
control callback (asix) 16
Done
control callback (asix) 17
Done
control callback (asix) 18
Done
control callback (asix) 19
Done
control callback (asix) 20
Done
control callback (asix) 21
Done
control callback (asix) 22
Done
control callback (asix) 23
Done
control callback (asix) 24
Done
control callback (asix) 25
Done
control callback (asix) 26
Done
control callback (asix) 27
Done
control callback (asix) 28
Done
control callback (asix) 29
Done
control callback (asix) 30
Done
control callback (asix) 31
Done
control callback (asix) 32
Done
control callback (asix) 33
Done
control callback (asix) 34
Done
control callback (asix) 35
Done
control callback (asix) 36
Done
control callback (asix) 37
Done
control callback (asix) 38
Done
control callback (asix) 39
Done
control callback (asix) 40
Done
control callback (asix) 41
Done
control callback (asix) 42
Done
control callback (asix) 43
Done
control callback (asix) 44
Done
control callback (asix) 45
Done
control callback (asix) 46
Done
control callback (asix) 47
Done
control callback (asix) 255
Looped: 1 LoopedUSB: 7487 LinkSpeed: 10BASE deg C=58
Looped: 1 LoopedUSB: 0 LinkSpeed: 10BASE deg C=58
Looped: 5602844 LoopedUSB: 1680 LinkSpeed: 10BASE deg C=59
control callback (asix) 49
Done
control callback (asix) 50
Done
control callback (asix) 51
Done
control callback (asix) 52
Done
control callback (asix) 53
Done
control callback (asix) 54
Done
control callback (asix) 55
Done
control callback (asix) 56
Done
control callback (asix) 57
Done
control callback (asix) 58
Done
control callback (asix) 59
Done
control callback (asix) 60
Done
control callback (asix) 61
Done
control callback (asix) 62
Done
control callback (asix) 63
Done
control callback (asix) 64
Done
control callback (asix) 65
Done
control callback (asix) 254
Mutex initialized: 0
Mutex initialized: 1
TCP/IP stack initialization is done.
SetMACAddress: 0050B6BE8BB4
MulticastJoin: 333300000001
MulticastTable:
0
0
10000000
0
0
0
0
0
MulticastJoin: 3333FFE225AB
MulticastTable:
0
0
10000000
0
0
0
0
100000
netif Initialized
Initializing DHCP
DHCP initialization done!
IPAddress: 0.0.0.0
SubnetMask: 0.0.0.0
Gateway: 0.0.0.0
DHCPServer: 0.0.0.0
State: 2
control callback (asix) 254
control callback (asix) 254
IPAddress: 192.168.0.12
SubnetMask: 255.255.255.0
Gateway: 192.168.0.1
DHCPServer: 192.168.0.1
State: 5
Looped: 11404940 LoopedUSB: 3507 FNETMemFree: 64656 LinkSpeed: 100BASE deg C=60
Looped: 11224911 LoopedUSB: 3486 FNETMemFree: 64656 LinkSpeed: 100BASE deg C=59
Looped: 11223853 LoopedUSB: 3507 FNETMemFree: 64656 LinkSpeed: 100BASE deg C=60
Looped: 11223976 LoopedUSB: 3507 FNETMemFree: 64656 LinkSpeed: 100BASE deg C=60
best_bandwidth = 3, at offset = 0
Control - ASIX...
Descriptor 5 = ENDPOINT
Descriptor 5 = ENDPOINT
Descriptor 5 = ENDPOINT