How to change UART2 TX Buffer limit?
Posted: Thu Aug 04, 2022 4:26 pm
Hello, I am using an ESP32 and a STM32 microcontroller in the same project. To communicate between the two i use UART2. I am trying to send structures between the two.I can receive from the STM fine but when i try to send a structure to the STM, i only receives 128 bytes. I don't know how i can change this limit. I would like to change it to 512.
I tried to change the tx_buffer_size in the driver install function to the same as the rx_buffer_size but everytime i send the structure the ESP reboots. I also tried to change some of the FIFO buffer sizes but to no avail.
Does anyone know how to change this limit?
Thank you.
Code: Select all
void init_uart2(){
uart_debug.index=0;
uart_debug.f_receive=0;
//esp_log_level_set(TAGu2, ESP_LOG_INFO);
/* Configure parameters of an UART driver,
* communication pins and install the driver */
uart_config_t uart_config = {
.baud_rate = 19200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
};
uart_param_config(UART_NUM_2, &uart_config);
uart_set_pin(UART_NUM_2, PIN_TX_UART_2, PIN_RX_UART_2, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
uart_driver_install(UART_NUM_2, BUFFER_SIZE_UART2 * 2, 0,0, NULL, 0);
uart_isr_free(UART_NUM_2);
uart_isr_register(UART_NUM_2,uart2_intr_handle, NULL, ESP_INTR_FLAG_IRAM, &handle_console);
uart_enable_rx_intr(UART_NUM_2);
myputsU0("\n \n Init Uart2 ok.\n");
}
Does anyone know how to change this limit?
Thank you.