[Codebox]
#define UART2_TX_PIN 17
#define UART2_RX_PIN 16
char uartTxBuff[11] = "INDIA WON\n";
inside the main function
//Initialize the UART
//Baud Rate
//Parity
//Data Bits
//Stop Bits
//Flow Control
uart_set_baudrate(UART_NUM_2, 115200);
uart_set_parity(UART_NUM_2, UART_PARITY_DISABLE);
uart_set_word_length(UART_NUM_2, UART_DATA_8_BITS);
uart_set_stop_bits(UART_NUM_2, UART_STOP_BITS_1);
uart_set_hw_flow_ctrl(UART_NUM_2, UART_HW_FLOWCTRL_DISABLE, 0);
// Set Uart Pins: TX, RX, RTS, CTS)
uart_set_pin(UART_NUM_2, UART2_TX_PIN, UART2_RX_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
uart_driver_install(UART_NUM_2, 1024 * 2, 0, 0, NULL, 0);
While(1)
{
uart_write_bytes(UART_NUM_2, uartTxBuff, 10);
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("Hello Pallav!\n");
}
[/Codebox]
I am able to see Hello Pallav getting printed in make monitor but on GPIO 17 I don't get any data out, I am checking with Logic Analyzer.
When I did UART configuration like following, it works
uart_config_t uart_config = {
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
};
// Configure UART parameters
ESP_ERROR_CHECK(uart_param_config(UART_NUM_2, &uart_config));
Anyone have an idea where I am going wrong in fist place?
UART Config Issue
-
- Posts: 5
- Joined: Wed Mar 18, 2020 5:32 pm
Re: UART Config Issue
Probably not calling uart_module_enable
-
- Posts: 5
- Joined: Wed Mar 18, 2020 5:32 pm
Re: UART Config Issue
what is that?
which API you mean?
which API you mean?
Who is online
Users browsing this forum: No registered users and 382 guests