Skip to content

Commit ea04975

Browse files
committed
feat(esp8266): Add configuration for UART baudrate
1 parent 7679495 commit ea04975

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

components/bootloader_support/src/bootloader_init.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ void __assert_func(const char *file, int line, const char *func, const char *exp
553553
#include "esp8266/pin_mux_register.h"
554554
#include "esp8266/rom_functions.h"
555555

556-
#define CONFIG_CONSOLE_UART_BAUDRATE 74880
557556
#define BOOTLOADER_CONSOLE_CLK_FREQ 52 * 1000 * 1000
558557

559558
extern int _bss_start;
@@ -575,8 +574,6 @@ static void uart_console_configure(void)
575574
CLEAR_PERI_REG_MASK(UART_CONF1(CONFIG_CONSOLE_UART_NUM), UART_RX_FLOW_EN);
576575
CLEAR_PERI_REG_MASK(UART_CONF0(CONFIG_CONSOLE_UART_NUM), UART_TX_FLOW_EN);
577576

578-
uart_div_modify(CONFIG_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_CONSOLE_UART_BAUDRATE);
579-
580577
WRITE_PERI_REG(UART_CONF0(CONFIG_CONSOLE_UART_NUM),
581578
0 // None parity
582579
| (1 << 4) // 1-bit stop
@@ -587,6 +584,8 @@ static void uart_console_configure(void)
587584
SET_PERI_REG_MASK(UART_CONF0(CONFIG_CONSOLE_UART_NUM), UART_RXFIFO_RST | UART_TXFIFO_RST);
588585
CLEAR_PERI_REG_MASK(UART_CONF0(CONFIG_CONSOLE_UART_NUM), UART_RXFIFO_RST | UART_TXFIFO_RST);
589586
#endif
587+
588+
uart_div_modify(CONFIG_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_CONSOLE_UART_BAUDRATE);
590589
}
591590

592591
esp_err_t bootloader_init()

components/esp8266/Kconfig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ config SOC_FULL_ICACHE
3535
Enable this option, full 32 KB iram instead of 16 KB iram will be used as icache, so the heap use can use
3636
may reduce a lot.
3737

38-
endmenu
39-
4038
choice CONSOLE_UART_NUM
4139
prompt "UART peripheral to use for console output (0-1)"
4240
default CONSOLE_UART_CUSTOM_NUM_0
@@ -54,6 +52,13 @@ config CONSOLE_UART_NUM
5452
default 0 if CONSOLE_UART_CUSTOM_NUM_0
5553
default 1 if CONSOLE_UART_CUSTOM_NUM_1
5654

55+
config CONSOLE_UART_BAUDRATE
56+
int "UART console baud rate"
57+
default 74880
58+
range 1200 4000000
59+
60+
endmenu
61+
5762
menu WIFI
5863

5964
config SCAN_AP_MAX

components/esp8266/lib/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
gwen:
22
crypto: 8943c89
3-
core: 782e796
3+
core: 4be8e4a
44
net80211: 5319ba0
55
pp: 830c0c8
66
smartconfig:68bd9c5

components/esp8266/lib/libcore.a

64 Bytes
Binary file not shown.

components/esp8266/source/phy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void write_data_to_rtc(uint8_t *);
3030

3131
void get_data_from_rtc(uint8_t *);
3232

33-
uint8_t chip_init(uint8_t* init_data, uint8_t *mac);
33+
uint8_t chip_init(uint8_t* init_data, uint8_t *mac, uint32_t uart_baudrate);
3434

3535
#ifdef __cplusplus
3636
}

components/esp8266/source/phy_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t *init_data, esp_phy_calibrat
8484
}
8585

8686
esp_efuse_mac_get_default(sta_mac);
87-
chip_init(local_init_data, sta_mac);
87+
chip_init(local_init_data, sta_mac, CONFIG_CONSOLE_UART_BAUDRATE);
8888
get_data_from_rtc((uint8_t *)calibration_data);
8989

9090
memcpy(rx_gain_dc_table, calibration_data->rx_gain_dc_table, 4 * 125);

0 commit comments

Comments
 (0)