I have done a benchmark with different options for USB CDC PC TX and Chibios RX:
The new driver is very good (versus old chibios 3 driver) only for packet >= 1000 bytes (which reach about 850KB/s with USB 2.0 FS on STM32F405@168MHz)
It is strange but during test with my PC at different time (probably related to my PC) the performance on small packet have changed see bench_chibios4_test3.txt (with big buffer we reach pratically 1MB/s so not far from 1.1MB/s theory for USB 2.0 FS)
bench_chibios3.txthttps://github.com/bvernoux/hydrafw/com ... c365248dd1HydraFW (HydraBus) v0.7-beta-3-g81f925c 2016-04-26
Kernel: ChibiOS 3.0.0dev
Compiler: GCC 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601]
int cmd_debug_test_rx(t_hydra_console *con, t_tokenline_parsed *p)
{
(void)p;
cprintf(con, "Test debug-rx started, stop it with UBTN + Key\r\n");
while(1) {
/* Exit if User Button is pressed */
if (USER_BUTTON) {
break;
}
get_char(con);
}
return TRUE;
}
packet_Length: 64 num_Packets: 1000
TX Time: 0.21900 s
TX Bytes/s: 292237 TX KBytes/s: 285.39
packet_Length: 128 num_Packets: 500
TX Time: 0.18700 s
TX Bytes/s: 342245 TX KBytes/s: 334.22
packet_Length: 256 num_Packets: 500
TX Time: 0.24900 s
TX Bytes/s: 514056 TX KBytes/s: 502.01
packet_Length: 500 num_Packets: 500
TX Time: 0.43700 s
TX Bytes/s: 572082 TX KBytes/s: 558.67
packet_Length: 512 num_Packets: 500
TX Time: 0.46800 s
TX Bytes/s: 547008 TX KBytes/s: 534.19
packet_Length: 1000 num_Packets: 500
TX Time: 0.85800 s
TX Bytes/s: 582750 TX KBytes/s: 569.09
packet_Length: 1008 num_Packets: 500
TX Time: 0.85800 s
TX Bytes/s: 587412 TX KBytes/s: 573.65
packet_Length: 1024 num_Packets: 500
TX Time: 0.87300 s
TX Bytes/s: 586483 TX KBytes/s: 572.74
packet_Length: 1280 num_Packets: 400
TX Time: 0.85800 s
TX Bytes/s: 596736 TX KBytes/s: 582.75
packet_Length: 2000 num_Packets: 400
TX Time: 1.32600 s
TX Bytes/s: 603318 TX KBytes/s: 589.18
packet_Length: 2048 num_Packets: 400
TX Time: 1.37300 s
TX Bytes/s: 596649 TX KBytes/s: 582.67
packet_Length: 3000 num_Packets: 400
TX Time: 1.98100 s
TX Bytes/s: 605754 TX KBytes/s: 591.56
bench_chibios4_test1.txthttps://github.com/bvernoux/hydrafw/tree/dev_chibioshttps://github.com/bvernoux/hydrafw/com ... 70c8e82c64HydraFW (HydraBus) v0.7-beta-7-g1a35534-dirty 2016-05-01
Kernel: ChibiOS 4.0.0
Compiler: GCC 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601]
#define SERIAL_USB_BUFFERS_SIZE 1280
// Modified bench code
int cmd_debug_test_rx(t_hydra_console *con, t_tokenline_parsed *p)
{
(void)p;
BaseSequentialStream* chp = con->bss;
cprintf(con, "Test debug-rx started, stop it with UBTN + Key\r\n");
while(1) {
chnRead(chp, (uint8_t *)g_sbuf, sizeof(g_sbuf) - 1);
/* Exit if User Button is pressed */
if (USER_BUTTON) {
break;
}
//get_char(con);
}
return TRUE;
}
packet_Length: 64 num_Packets: 1000
TX Time: 0.22200 s
TX Bytes/s: 288288 TX KBytes/s: 281.53
packet_Length: 128 num_Packets: 500
TX Time: 0.17200 s
TX Bytes/s: 372093 TX KBytes/s: 363.37
packet_Length: 256 num_Packets: 500
TX Time: 0.25000 s
TX Bytes/s: 512000 TX KBytes/s: 500.00
packet_Length: 500 num_Packets: 500
TX Time: 0.37900 s
TX Bytes/s: 659630 TX KBytes/s: 644.17
packet_Length: 512 num_Packets: 500
TX Time: 0.40300 s
TX Bytes/s: 635235 TX KBytes/s: 620.35
packet_Length: 1000 num_Packets: 500
TX Time: 0.65900 s
TX Bytes/s: 758725 TX KBytes/s: 740.94
packet_Length: 1008 num_Packets: 500
TX Time: 0.67800 s
TX Bytes/s: 743362 TX KBytes/s: 725.94
packet_Length: 1024 num_Packets: 500
TX Time: 0.68700 s
TX Bytes/s: 745269 TX KBytes/s: 727.80
packet_Length: 1280 num_Packets: 400
TX Time: 0.65900 s
TX Bytes/s: 776934 TX KBytes/s: 758.73
packet_Length: 2000 num_Packets: 400
TX Time: 0.99600 s
TX Bytes/s: 803212 TX KBytes/s: 784.39
packet_Length: 2048 num_Packets: 400
TX Time: 1.02400 s
TX Bytes/s: 799999 TX KBytes/s: 781.25
packet_Length: 3000 num_Packets: 400
TX Time: 1.43800 s
TX Bytes/s: 834492 TX KBytes/s: 814.93
bench_chibios4_test2.txthttps://github.com/bvernoux/hydrafw/tree/dev_chibioshttps://github.com/bvernoux/hydrafw/com ... 70c8e82c64HydraFW (HydraBus) v0.7-beta-7-g1a35534-dirty 2016-05-01
Kernel: ChibiOS 4.0.0
Compiler: GCC 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601]
#define SERIAL_USB_BUFFERS_SIZE 256
// Modified bench code
int cmd_debug_test_rx(t_hydra_console *con, t_tokenline_parsed *p)
{
(void)p;
BaseSequentialStream* chp = con->bss;
cprintf(con, "Test debug-rx started, stop it with UBTN + Key\r\n");
while(1) {
chnRead(chp, (uint8_t *)g_sbuf, sizeof(g_sbuf) - 1);
/* Exit if User Button is pressed */
if (USER_BUTTON) {
break;
}
//get_char(con);
}
return TRUE;
}
packet_Length: 64 num_Packets: 1000
TX Time: 1.00000 s
TX Bytes/s: 64000 TX KBytes/s: 62.50
packet_Length: 128 num_Packets: 500
TX Time: 0.49900 s
TX Bytes/s: 128256 TX KBytes/s: 125.25
packet_Length: 256 num_Packets: 500
TX Time: 0.49900 s
TX Bytes/s: 256512 TX KBytes/s: 250.50
packet_Length: 500 num_Packets: 500
TX Time: 0.50000 s
TX Bytes/s: 500000 TX KBytes/s: 488.28
packet_Length: 512 num_Packets: 500
TX Time: 0.50000 s
TX Bytes/s: 512000 TX KBytes/s: 500.00
packet_Length: 1000 num_Packets: 500
TX Time: 0.57300 s
TX Bytes/s: 872600 TX KBytes/s: 852.15
packet_Length: 1008 num_Packets: 500
TX Time: 0.58300 s
TX Bytes/s: 864493 TX KBytes/s: 844.23
packet_Length: 1024 num_Packets: 500
TX Time: 0.58800 s
TX Bytes/s: 870748 TX KBytes/s: 850.34
packet_Length: 1280 num_Packets: 400
TX Time: 0.57900 s
TX Bytes/s: 884283 TX KBytes/s: 863.56
packet_Length: 2000 num_Packets: 400
TX Time: 0.84200 s
TX Bytes/s: 950118 TX KBytes/s: 927.85
packet_Length: 2048 num_Packets: 400
TX Time: 0.88900 s
TX Bytes/s: 921484 TX KBytes/s: 899.89
packet_Length: 3000 num_Packets: 400
TX Time: 1.26100 s
TX Bytes/s: 951625 TX KBytes/s: 929.32
bench_chibios4_test3.txthttps://github.com/bvernoux/hydrafw/tree/dev_chibioshttps://github.com/bvernoux/hydrafw/com ... 70c8e82c64HydraFW (HydraBus) v0.7-beta-7-g1a35534-dirty 2016-05-01
Kernel: ChibiOS 4.0.0
Compiler: GCC 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601]
#define SERIAL_USB_BUFFERS_SIZE 512
or
#define SERIAL_USB_BUFFERS_SIZE 1280
// Modified bench code
int cmd_debug_test_rx(t_hydra_console *con, t_tokenline_parsed *p)
{
(void)p;
BaseSequentialStream* chp = con->bss;
cprintf(con, "Test debug-rx started, stop it with UBTN + Key\r\n");
while(1) {
chnRead(chp, (uint8_t *)g_sbuf, sizeof(g_sbuf) - 1);
/* Exit if User Button is pressed */
if (USER_BUTTON) {
break;
}
//get_char(con);
}
return TRUE;
}
packet_Length: 64 num_Packets: 1000
TX Time: 0.99900 s
TX Bytes/s: 64064 TX KBytes/s: 62.56
packet_Length: 128 num_Packets: 500
TX Time: 0.49900 s
TX Bytes/s: 128256 TX KBytes/s: 125.25
packet_Length: 256 num_Packets: 500
TX Time: 0.49900 s
TX Bytes/s: 256512 TX KBytes/s: 250.50
packet_Length: 500 num_Packets: 500
TX Time: 0.50000 s
TX Bytes/s: 500000 TX KBytes/s: 488.28
packet_Length: 512 num_Packets: 500
TX Time: 0.50000 s
TX Bytes/s: 512000 TX KBytes/s: 500.00
packet_Length: 1000 num_Packets: 500
TX Time: 0.63200 s
TX Bytes/s: 791139 TX KBytes/s: 772.60
packet_Length: 1008 num_Packets: 500
TX Time: 0.59800 s
TX Bytes/s: 842809 TX KBytes/s: 823.06
packet_Length: 1024 num_Packets: 500
TX Time: 0.62300 s
TX Bytes/s: 821829 TX KBytes/s: 802.57
packet_Length: 1280 num_Packets: 400
TX Time: 0.61500 s
TX Bytes/s: 832520 TX KBytes/s: 813.01
packet_Length: 2000 num_Packets: 400
TX Time: 0.85700 s
TX Bytes/s: 933489 TX KBytes/s: 911.61
packet_Length: 2048 num_Packets: 400
TX Time: 0.86600 s
TX Bytes/s: 945958 TX KBytes/s: 923.79
packet_Length: 3000 num_Packets: 400
TX Time: 1.26300 s
TX Bytes/s: 950118 TX KBytes/s: 927.85