I am using UART1 and it is working perfectly for me until an esp_restart() takes place. After that, nothing comes out of the transmit pin even though all of the calls return normal values.
A search has shown some issues regarding receiving (mostly in Arduino) but those all appear to be fixed and this is a transmit issue anyway.
Here is my initialization routine.
The arguments are port = UART_NUM_1, tx_io_num = 25, rx_io_num = 26.
Code: Select all
esp_err_t NamPort::Initialize(uart_port_t port, int tx_io_num, int rx_io_num) {
uart_config_t uart_config = {
.baud_rate = 62500,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 0,
.use_ref_tick = false
};
Port = port;
ESP_ERROR_CHECK(uart_param_config(Port, &uart_config));
ESP_ERROR_CHECK(uart_set_pin(Port, tx_io_num, rx_io_num, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
const int uart_buffer_size = (1024 * 2);
QueueHandle_t uart_queue;
// Install UART driver not using an event queue
ESP_ERROR_CHECK(uart_driver_install(Port, uart_buffer_size, 0, 10, &uart_queue, 0));
for (int i = 0; i < 5; i++) {
if (InitRF()) {
start();
return ESP_OK;
}
}
return ESP_ERR_NOT_SUPPORTED;
}
Code: Select all
void NamPort::SendMsg(byte* msg, size_t size) {
size_t sent = uart_write_bytes(Port, (const char*)msg, size);
assert(sent == size);
}
I am using the Release/v3.2 code branch from GitHub. I sure would appreciate any suggestions or workarounds.
Thanks,
Don