Skip to content

Commit 96154b5

Browse files
committed
Tests: USB: Remove TX_DELAY_MS from serial test
Remove TX_DELAY_MS and all the places it was called since it is not needed when DTR flow control is used.
1 parent 8f72f31 commit 96154b5

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

TESTS/usb_device/serial/main.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@
6060
// to handle the reconnect operation correctly.
6161
#define USB_DISCONNECT_DELAY_MS 1
6262

63-
// Despite having ECHO and ECHOCTL POSIX lflags disabled by default by
64-
// pyserial, a delay is needed for host to properly handle data received
65-
// from USB serial/CDC device.
66-
// With no delay host would echo 0x00-0x31 characters prefixed with '^'.
67-
#define TX_DELAY_MS 10
68-
6963
#define LINE_CODING_STRLEN 13 // 6 + 2 + 1 + 1 + 3 * comma
7064

7165
#define USB_DEV_SN_LEN (32) // 32 hex digit UUID
@@ -373,7 +367,6 @@ void test_cdc_rx_single_bytes_concurrent()
373367
usb_cdc.connect();
374368
greentea_send_kv(MSG_KEY_SEND_BYTES_SINGLE, MSG_VALUE_DUMMY);
375369
usb_cdc.wait_ready();
376-
wait_ms(TX_DELAY_MS);
377370
Thread tx_thread;
378371
event_flags.set(EF_SEND);
379372
tx_thread.start(mbed::callback(tx_thread_fun, &usb_cdc));
@@ -443,7 +436,6 @@ void test_cdc_rx_multiple_bytes_concurrent()
443436
usb_cdc.connect();
444437
greentea_send_kv(MSG_KEY_SEND_BYTES_MULTIPLE, HOST_RX_BUFF_SIZE_RATIO);
445438
usb_cdc.wait_ready();
446-
wait_ms(TX_DELAY_MS);
447439
Thread tx_thread;
448440
event_flags.set(EF_SEND);
449441
tx_thread.start(mbed::callback(tx_thread_fun, &usb_cdc));
@@ -485,7 +477,6 @@ void test_cdc_loopback()
485477
usb_cdc.connect();
486478
greentea_send_kv(MSG_KEY_LOOPBACK, MSG_VALUE_DUMMY);
487479
usb_cdc.wait_ready();
488-
wait_ms(TX_DELAY_MS);
489480
uint8_t rx_buff, tx_buff;
490481
for (int i = 0; i < CDC_LOOPBACK_REPS; i++) {
491482
tx_buff = (uint8_t)(rand() % 0x100);
@@ -660,10 +651,7 @@ void test_serial_printf_scanf()
660651
TestUSBSerial usb_serial(USB_SERIAL_VID, USB_SERIAL_PID, 1, usb_dev_sn);
661652
usb_serial.connect();
662653
greentea_send_kv(MSG_KEY_LOOPBACK, MSG_VALUE_DUMMY);
663-
while (!usb_serial.connected()) {
664-
wait_ms(1);
665-
}
666-
wait_ms(TX_DELAY_MS);
654+
usb_serial.wait_ready();
667655
static const char fmt[] = "Formatted\nstring %i.";
668656
int tx_val, rx_val, rc;
669657
for (int i = 0; i < SERIAL_LOOPBACK_REPS; i++) {
@@ -704,10 +692,7 @@ void test_serial_line_coding_change()
704692
TestUSBSerial usb_serial(USB_SERIAL_VID, USB_SERIAL_PID, 1, usb_dev_sn);
705693
usb_serial.connect();
706694
greentea_send_kv(MSG_KEY_CHANGE_LINE_CODING, MSG_VALUE_DUMMY);
707-
while (!usb_serial.connected()) {
708-
wait_ms(1);
709-
}
710-
wait_ms(TX_DELAY_MS);
695+
usb_serial.wait_ready();
711696
usb_serial.attach(line_coding_changed_cb);
712697
size_t num_line_codings = sizeof test_codings / sizeof test_codings[0];
713698
line_coding_t *lc_prev = &default_lc;

0 commit comments

Comments
 (0)