From c7bd7323ecf3d29178498d73e01888311d51ad24 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 8 Feb 2022 11:38:25 -0800 Subject: [PATCH] serial_test:Fix infinte TX loop with H7/DMA --- src/systemcmds/serial_test/serial_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/systemcmds/serial_test/serial_test.c b/src/systemcmds/serial_test/serial_test.c index ea721d47ba..c5d4d14c9f 100644 --- a/src/systemcmds/serial_test/serial_test.c +++ b/src/systemcmds/serial_test/serial_test.c @@ -574,6 +574,7 @@ static void process_read_data(struct g_mod_t *g_mod, struct cli_args_t *g_cl) static void process_write_data(struct g_mod_t *g_mod, struct cli_args_t *g_cl) { ssize_t count = 0; + int loops = 10; int repeat = (g_cl->_tx_bytes == 0); do { @@ -592,11 +593,14 @@ static void process_write_data(struct g_mod_t *g_mod, struct cli_args_t *g_cl) } c = 0; + + } else { + loops--; } count += c; - if (c < g_mod->_write_size) { + if (loops == 0 || c < g_mod->_write_size) { g_mod->_write_count_value = g_mod->_write_data[c]; repeat = 0; }