Skip to content

Commit

Permalink
Work around for 200 series
Browse files Browse the repository at this point in the history
  • Loading branch information
eandersson committed Nov 28, 2024
1 parent d69c9db commit ef6db86
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/asic/include/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
8 changes: 5 additions & 3 deletions components/asic/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion main/self_test/self_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit ef6db86

Please sign in to comment.