From bb6ba0b021e8b05b965f99c567f611377a15977f Mon Sep 17 00:00:00 2001 From: EricB-ADI <122300463+EricB-ADI@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:08:29 -0500 Subject: [PATCH 1/5] added terminal flush command .c --- Libraries/Cordio/wsf/sources/util/terminal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Libraries/Cordio/wsf/sources/util/terminal.c b/Libraries/Cordio/wsf/sources/util/terminal.c index 7d97f548ff7..a127ed2341e 100644 --- a/Libraries/Cordio/wsf/sources/util/terminal.c +++ b/Libraries/Cordio/wsf/sources/util/terminal.c @@ -496,3 +496,9 @@ static uint8_t terminalCommandEchoHandler(uint32_t argc, char **argv) return TERMINAL_ERROR_OK; } + +void TerminalFlush(void) +{ + memset(terminalCb.buf, 0, TERMINAL_MAX_COMMAND_LEN + 1); + terminalCb.bufOffset = 0; +} From 7be5852e5ca2617e7a100b0fcafc2d7ab7f31924 Mon Sep 17 00:00:00 2001 From: EricB-ADI <122300463+EricB-ADI@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:09:32 -0500 Subject: [PATCH 2/5] added func to .h --- Libraries/Cordio/wsf/include/util/terminal.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Libraries/Cordio/wsf/include/util/terminal.h b/Libraries/Cordio/wsf/include/util/terminal.h index d3b47ab6184..4d385923f3c 100644 --- a/Libraries/Cordio/wsf/include/util/terminal.h +++ b/Libraries/Cordio/wsf/include/util/terminal.h @@ -182,6 +182,13 @@ void TerminalTxPrint(const char *pStr, ...); /*************************************************************************************************/ void TerminalTx(const uint8_t *pData, uint16_t len); +/*************************************************************************************************/ +/*! + * \brief Flush terminal parser + */ +/*************************************************************************************************/ +void TerminalFlush(void); + /*! \} */ /* WSF_UTIL_API */ #endif /* TERMINAL_H */ From 75bc2c3d6a8eccc8ac52a962a829d0ff463b8a66 Mon Sep 17 00:00:00 2001 From: EricB-ADI <122300463+EricB-ADI@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:11:33 -0500 Subject: [PATCH 3/5] added terminal flush if error in console --- .../platform/targets/maxim/max32655/sources/pal_uart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c b/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c index 16dd4dd44a4..f9085c14a65 100644 --- a/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c +++ b/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c @@ -92,7 +92,12 @@ void UART_CommonHandler(mxc_uart_regs_t *uart) { const uint8_t uartIdx = MXC_UART_GET_IDX(uart); - if( uartIdx == CONSOLE_UART || uartIdx == HCI_UART) + if(uartIdx == CONSOLE_UART) + { + TerminalFlush(); + MXC_UART_ClearRXFIFO(uart); + } + else if(uartIdx == HCI_UART) { MXC_UART_ClearRXFIFO(uart); } From 02cf6c544d38f04cd5fd65f8fb6b141a6838a82c Mon Sep 17 00:00:00 2001 From: EricB-ADI <122300463+EricB-ADI@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:26:09 -0500 Subject: [PATCH 4/5] added terminal flush to 690 --- .../platform/targets/maxim/max32690/sources/pal_uart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c b/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c index b5b49f3cccc..d77c04b0629 100644 --- a/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c +++ b/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c @@ -90,7 +90,12 @@ void UART_CommonHandler(mxc_uart_regs_t *uart) { const uint8_t uartIdx = MXC_UART_GET_IDX(uart); - if( uartIdx == CONSOLE_UART || uartIdx == HCI_UART) + if(uartIdx == CONSOLE_UART) + { + TerminalFlush(); + MXC_UART_ClearRXFIFO(uart); + } + else if(uartIdx == HCI_UART) { MXC_UART_ClearRXFIFO(uart); } From fcdd31ec3bfdca771c583eaa7a7d94ccac3b7de3 Mon Sep 17 00:00:00 2001 From: crsz20 Date: Fri, 4 Oct 2024 11:28:38 -0500 Subject: [PATCH 5/5] Added TerminalFlush() to pal_uart for ME17 and ME18 --- .../platform/targets/maxim/max32655/sources/pal_uart.c | 2 ++ .../platform/targets/maxim/max32690/sources/pal_uart.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c b/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c index f9085c14a65..ac6a7bd4e1c 100644 --- a/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c +++ b/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c @@ -31,6 +31,8 @@ */ /*************************************************************************************************/ +#include "util/terminal.h" + #include "pal_uart.h" #include "pal_led.h" #include "pal_sys.h" diff --git a/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c b/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c index b5b49f3cccc..3f3d2e6c165 100644 --- a/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c +++ b/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c @@ -31,6 +31,8 @@ */ /*************************************************************************************************/ +#include "util/terminal.h" + #include "pal_uart.h" #include "pal_led.h" #include "pal_sys.h" @@ -90,10 +92,16 @@ void UART_CommonHandler(mxc_uart_regs_t *uart) { const uint8_t uartIdx = MXC_UART_GET_IDX(uart); - if( uartIdx == CONSOLE_UART || uartIdx == HCI_UART) + if( uartIdx == CONSOLE_UART) { + TerminalFlush(); MXC_UART_ClearRXFIFO(uart); } + else if(uartIdx == HCI_UART) + { + MXC_UART_ClearRXFIFO(uart); + } + else { PAL_SYS_ASSERT(err == E_NO_ERROR);