Hello,
I am using ESP-IDF version 4.2. I am referring UART event example for the development of my project.
The example link is available below.
https://github.com/espressif/esp-idf/bl ... ple_main.c
As per my project requirement, I want to get 256 bytes from UART using xQueueReceive API and expecting 256 values from event.size. But it can receive only 120 bytes. When I was checking uart driver code, found that UART_FIFO_LEN is 128 bytes and UART_FULL_THRESH_DEFAULT is 120 bytes. Can we update this value?
Please help me to resolve this issue. I think multiple developers might facing the same issue. I am using UART_NUM_2 and GPIO21 and GPIO22 using for Tx and Rx pin respectively.
Regards,
Neel
Couldn't receive more than 120 bytes from UART interrupt
-
- Posts: 2
- Joined: Thu Jun 24, 2021 5:40 pm
Re: Couldn't receive more than 120 bytes from UART interrupt
You can wait until more bytes are available before calling uart_read_bytes if you want to leave them in the RX buffer
-
- Posts: 2
- Joined: Thu Jun 24, 2021 5:40 pm
Re: Couldn't receive more than 120 bytes from UART interrupt
Hello friend,
This is a small but very useful solution. I could resolve the issue.
Please find below the code snippet and let me know if you have any suggestions.
Regards,
Neel
This is a small but very useful solution. I could resolve the issue.
Please find below the code snippet and let me know if you have any suggestions.
- int ring_buff_len;
- int len;
- int timeout = 1000; // in msec
- if(xQueueReceive(uart0_queue, (void * )&event, timeout / portTICK_RATE_MS)) {
- bzero(dtmp, RD_BUF_SIZE);
- switch(event.type) {
- //Event of UART receving data
- case UART_DATA:
- vTaskDelay(10 / portTICK_RATE_MS); // 10 msec sleep
- uart_get_buffered_data_len(EX_UART_NUM, (size_t *) &ring_buff_len);
- len = uart_read_bytes(EX_UART_NUM, dtmp, ring_buff_len, 0);
- break;
- }
- }
Neel
Who is online
Users browsing this forum: mubeenkhalid007 and 263 guests