From ef6db86e6a7d5130e676b2f9dbcf616eb67a1981 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Thu, 28 Nov 2024 20:58:01 +0100 Subject: [PATCH] Work around for 200 series --- components/asic/include/serial.h | 2 +- components/asic/serial.c | 8 +++++--- main/main.c | 2 +- main/self_test/self_test.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/asic/include/serial.h b/components/asic/include/serial.h index a8adef983..1560fd27b 100644 --- a/components/asic/include/serial.h +++ b/components/asic/include/serial.h @@ -9,6 +9,6 @@ void SERIAL_init(void); void SERIAL_debug_rx(void); int16_t SERIAL_rx(uint8_t *, uint16_t, uint16_t); void SERIAL_clear_buffer(void); -void SERIAL_set_baud(int baud); +void SERIAL_set_baud(int baud, bool wait); #endif /* SERIAL_H_ */ \ No newline at end of file diff --git a/components/asic/serial.c b/components/asic/serial.c index b18877fe4..11bc561f0 100644 --- a/components/asic/serial.c +++ b/components/asic/serial.c @@ -43,12 +43,14 @@ void SERIAL_init(void) uart_driver_install(UART_NUM_1, BUF_SIZE * 2, BUF_SIZE * 2, 0, NULL, 0); } -void SERIAL_set_baud(int baud) +void SERIAL_set_baud(int baud, bool wait) { ESP_LOGI(TAG, "Changing UART baud to %i", baud); - // Make sure that we are done writing before setting a new baudrate. - uart_wait_tx_done(UART_NUM_1, 1000 / portTICK_PERIOD_MS); + if (wait) { + // Make sure that we are done writing before setting a new baudrate. + uart_wait_tx_done(UART_NUM_1, 1000 / portTICK_PERIOD_MS); + } uart_set_baudrate(UART_NUM_1, baud); } diff --git a/main/main.c b/main/main.c index dbc467bf9..7b51abfd5 100644 --- a/main/main.c +++ b/main/main.c @@ -126,7 +126,7 @@ void app_main(void) SERIAL_init(); (*GLOBAL_STATE.ASIC_functions.init_fn)(GLOBAL_STATE.POWER_MANAGEMENT_MODULE.frequency_value, GLOBAL_STATE.asic_count); - SERIAL_set_baud((*GLOBAL_STATE.ASIC_functions.set_max_baud_fn)()); + SERIAL_set_baud((*GLOBAL_STATE.ASIC_functions.set_max_baud_fn)(), GLOBAL_STATE.board_version >= 300); SERIAL_clear_buffer(); GLOBAL_STATE.ASIC_initalized = true; diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 9eb92de3a..6242452cd 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -241,7 +241,7 @@ void self_test(void * pvParameters) int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); vTaskDelay(10 / portTICK_PERIOD_MS); - SERIAL_set_baud(baud); + SERIAL_set_baud(baud, GLOBAL_STATE->board_version >= 300); vTaskDelay(1000 / portTICK_PERIOD_MS);