mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/esp32: improve UART initialization
The TX line is set and temporarily configured as a pull-up open-drain output before configuring it as a push-pull output to avoid a several msec long LOW pulse resulting in some garbage.
This commit is contained in:
parent
fe21e82079
commit
3085b92e8f
@ -179,11 +179,14 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
|
||||
gpio_set_pin_usage(uart_config[uart].rxd, _GPIO);
|
||||
}
|
||||
|
||||
/* try to initialize the pins as GPIOs first */
|
||||
if ((uart_config[uart].txd != GPIO_UNDEF &&
|
||||
gpio_init(uart_config[uart].txd, GPIO_OUT)) ||
|
||||
(uart_config[uart].rxd != GPIO_UNDEF &&
|
||||
gpio_init(uart_config[uart].rxd, GPIO_IN_PU))) {
|
||||
/* Try to initialize the pins where the TX line is set and temporarily
|
||||
* configured as a pull-up open-drain output before configuring it as
|
||||
* a push-pull output to avoid a several msec long LOW pulse resulting
|
||||
* in some garbage */
|
||||
gpio_set(uart_config[uart].txd);
|
||||
if (gpio_init(uart_config[uart].txd, GPIO_OD_PU) ||
|
||||
gpio_init(uart_config[uart].txd, GPIO_OUT) ||
|
||||
gpio_init(uart_config[uart].rxd, GPIO_IN_PU)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user