DMA example for UART communication for ESP32
DMA example for UART communication for ESP32
Hi,
We are working on ESP32 board and also using ESP32 IDF for application development as per our project Requirement.
Right now, we had connected two different RF module over UART in which sometimes both modules are sending 128 bytes packets at interval of 100 milliseconds. Here, we are using interrupt based communication to get data from UART as per provided into example.
So, at every one byte, we are getting interrupt which creates Task Watchdog Timeout after some interval because of not feeding of Watchdog Time. As both tasks to get data from different UART are too much busy or we can say in blocking state.
So, we are now thinking to use DMA for that to become communication faster. We already had started to look User Manual of ESP32 for DMA and found some information but not found any example for that.
So, Does anyone has implemented UART based communication using DMA? If yes then please provide sample example or link for that.
We are working on ESP32 board and also using ESP32 IDF for application development as per our project Requirement.
Right now, we had connected two different RF module over UART in which sometimes both modules are sending 128 bytes packets at interval of 100 milliseconds. Here, we are using interrupt based communication to get data from UART as per provided into example.
So, at every one byte, we are getting interrupt which creates Task Watchdog Timeout after some interval because of not feeding of Watchdog Time. As both tasks to get data from different UART are too much busy or we can say in blocking state.
So, we are now thinking to use DMA for that to become communication faster. We already had started to look User Manual of ESP32 for DMA and found some information but not found any example for that.
So, Does anyone has implemented UART based communication using DMA? If yes then please provide sample example or link for that.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: DMA example for UART communication for ESP32
Hi Loboris or Espressif Systems Developer,
Do you have any idea or any base examples for how to use DMA for UART into ESP32?
Please let me know reference link or any example based on that ASAP.
Do you have any idea or any base examples for how to use DMA for UART into ESP32?
Please let me know reference link or any example based on that ASAP.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: DMA example for UART communication for ESP32
I don't think there is any need to use DMA with UART with your usage case.
I'm only using the uart event task, similar to esp-idf/examples/peripherals/uart_events example.
I've newer had any problems with it and response time is quite fast.
At 128 byte packets every 100 ms you should have no problem, I've tested it with much longer packets and much shorter intervals.
I only have an example in my MicroPython port, the source is here.
I'm only using the uart event task, similar to esp-idf/examples/peripherals/uart_events example.
I've newer had any problems with it and response time is quite fast.
At 128 byte packets every 100 ms you should have no problem, I've tested it with much longer packets and much shorter intervals.
I only have an example in my MicroPython port, the source is here.
Re: DMA example for UART communication for ESP32
The problem is setting fifo threshold to 1 byte
Re: DMA example for UART communication for ESP32
Hi, We are developing application and we are using so many tasks in our application.loboris wrote:I don't think there is any need to use DMA with UART with your usage case.
I'm only using the uart event task, similar to esp-idf/examples/peripherals/uart_events example.
I've newer had any problems with it and response time is quite fast.
At 128 byte packets every 100 ms you should have no problem, I've tested it with much longer packets and much shorter intervals.
I only have an example in my MicroPython port, the source is here.
So, We are using interrupt based UART task to receive data from your continuously with 1 byte interrupt.
Also, We are validating received frame and sent it to cloud with proper packet encoding.
Also we had connected 2 different RF module over 2 UART which sending data continuesly 100 msec of interval.
Let me know if you need any other information regarding this
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: DMA example for UART communication for ESP32
We didn't set fifo threshold to 1 byte but set 1 byte as interrupt to get each byte interrupt.WiFive wrote:The problem is setting fifo threshold to 1 byte
So, will it create any problem while receiving data from both UART at every 100 msec?
Let me know if you had any idea regarding DMA UART example or any information regarding that.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: DMA example for UART communication for ESP32
Isn't that the same thing?Ritesh wrote:
We didn't set fifo threshold to 1 byte but set 1 byte as interrupt to get each byte interrupt.
Code: Select all
uint8_t rxfifo_full_thresh
UART RX full interrupt threshold.
Re: DMA example for UART communication for ESP32
We don't have fixed size of frame coming from UART module to ESP32. Right now, we are testing with fixed length of frame but in real communication it is not fixed as that will be variable.WiFive wrote:Isn't that the same thing?Ritesh wrote:
We didn't set fifo threshold to 1 byte but set 1 byte as interrupt to get each byte interrupt.
Why do you need an interrupt for each byte? Default is 120.Code: Select all
uint8_t rxfifo_full_thresh UART RX full interrupt threshold.
That is why we had kept interrupt for one byte to serve lowest to lowest frame of one byte as well.
So, what you suggest to do in this type of variable frame communication in fast interval like 100 msec?
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: DMA example for UART communication for ESP32
End of frame will also generate tout interrupt so unless you need ultra realtime processing of messages it should be ok.
Re: DMA example for UART communication for ESP32
Let's consider our UART module is going to send packets with variable size in every 100 msec of interval over Interrupt and also it needs some little bit time to process that packet then how we can handle that type of situation using tout Interrupt?WiFive wrote:End of frame will also generate tout interrupt so unless you need ultra realtime processing of messages it should be ok.
Would you please give me example for that?
Regards,
Ritesh Prajapati
Ritesh Prajapati
Who is online
Users browsing this forum: jsmith56x and 287 guests