TX UART open drain mode
Posted: Fri Nov 10, 2023 2:22 pm
I am trying to use GPIO 21 on ESP32 C3 for UART0 TX. I would like uses it with open drive feature.
I have tried with API and with register level instructions.
In API the instructions are the follow:
ESP_ERROR_CHECK(uart_param_config(S_BusPort, &uart_config_1));
ESP_ERROR_CHECK (uart_driver_install(S_BusPort, 1024, 1024, 0, NULL, 0));
……
ESP_ERROR_CHECK(uart_set_pin(S_BusPort, 21, 20, -1, -1));
……
ESP_ERROR_CHECK(gpio_set_direction (GPIO_NUM_21, GPIO_MODE_OUTPUT_OD));
ESP_ERROR_CHECK(gpio_pullup_en(GPIO_NUM_21));
The TX UART signal come out properly but not in open drain mode (both the rising and falling fronts are very steep).
Using register the instruction are the follow:
ESP_ERROR_CHECK(uart_param_config(S_BusPort, &uart_config_1));
ESP_ERROR_CHECK (uart_driver_install(S_BusPort, 1024, 1024, 0, NULL, 0));
……
REG_WRITE(GPIO_FUNC21_OUT_SEL_CFG_REG,0x006); //connect UART0 output signal to GPIO21
REG_WRITE(GPIO_PIN21_REG,0x04); //open drain activated
REG_WRITE(IO_MUX_GPIO21_REG,0x0900); //pull up activated
Also in this case the output UART signal come out properly but not in open drain mode.
Is there some thing wrong? Can someone help me? Or, simply, doesn’t ESP32 C3 support open drain mode when the GPIO is linked to the UART0 TX signal?
Thanks in advance.
Best regards,
Freddy_13
I have tried with API and with register level instructions.
In API the instructions are the follow:
ESP_ERROR_CHECK(uart_param_config(S_BusPort, &uart_config_1));
ESP_ERROR_CHECK (uart_driver_install(S_BusPort, 1024, 1024, 0, NULL, 0));
……
ESP_ERROR_CHECK(uart_set_pin(S_BusPort, 21, 20, -1, -1));
……
ESP_ERROR_CHECK(gpio_set_direction (GPIO_NUM_21, GPIO_MODE_OUTPUT_OD));
ESP_ERROR_CHECK(gpio_pullup_en(GPIO_NUM_21));
The TX UART signal come out properly but not in open drain mode (both the rising and falling fronts are very steep).
Using register the instruction are the follow:
ESP_ERROR_CHECK(uart_param_config(S_BusPort, &uart_config_1));
ESP_ERROR_CHECK (uart_driver_install(S_BusPort, 1024, 1024, 0, NULL, 0));
……
REG_WRITE(GPIO_FUNC21_OUT_SEL_CFG_REG,0x006); //connect UART0 output signal to GPIO21
REG_WRITE(GPIO_PIN21_REG,0x04); //open drain activated
REG_WRITE(IO_MUX_GPIO21_REG,0x0900); //pull up activated
Also in this case the output UART signal come out properly but not in open drain mode.
Is there some thing wrong? Can someone help me? Or, simply, doesn’t ESP32 C3 support open drain mode when the GPIO is linked to the UART0 TX signal?
Thanks in advance.
Best regards,
Freddy_13