Skip to content

Commit

Permalink
fix(ESPAT-1934): Fixed that uart cannot work if upgrades from v2.0 to…
Browse files Browse the repository at this point in the history
… v3.3

Reason:
On v2.0.0.0 version, UART port configuration was not stored in flash. The UART port read from flash was actually an incorrect value, further resulting in UART malfunction.

Fix:
Set the default UART port, then read the UART port from flash. If it is valid, overwrite the default UART port.
  • Loading branch information
ustccw committed Feb 21, 2024
1 parent 5bc838f commit 6efc64d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main/interface/uart/at_uart_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ esp_err_t at_mfg_uart_port_pins_get(at_uart_port_pins_t *config)
config->rts_pin = CONFIG_AT_UART_PORT_RTS_PIN_DEFAULT;

// get uart port and uart pins from flash
int8_t uart_num;
int8_t uart_num = g_at_cmd_port;
int32_t tx_pin, rx_pin, cts_pin, rts_pin;
at_mfg_params_storage_mode_t mode = at_get_mfg_params_storage_mode();
if (mode == AT_PARAMS_IN_MFG_NVS) {
Expand Down Expand Up @@ -193,7 +193,9 @@ esp_err_t at_mfg_uart_port_pins_get(at_uart_port_pins_t *config)
return ESP_FAIL;
}
// uart configurations are stored in the 12nd to 19th bytes of the partition
uart_num = data[5];
if (data[5] != 0xFF) {
uart_num = data[5];
}
if (data[16] != 0xFF && data[17] != 0xFF) {
tx_pin = data[16];
rx_pin = data[17];
Expand Down

0 comments on commit 6efc64d

Please sign in to comment.