UART software flow control in ESP32S3
Posted: Wed Nov 08, 2023 6:13 am
I'm using an ESP32S3 chip and trying to implement OTA through a cellular modem. The size of the bin file is 1250KB. The cellular modem has an AT command that downloads all the content in one go. Since there is no option to read it in chunks and there is not enough RAM to hold that 1250 KB of data. So I have decided to read the data in chunks from the RX FIFO buffer.
Now when I'm reading the data from UART and printing it, I'm receiving all the data properly. But when I'm trying to store the downloaded content into a local file in the file system. Data is being missed. I understood that this UART task should be performed uninterrupted.
For this, I tried running file writing tasks separately using xSemaphoreCreateMutex() but still the data is missing.
Now I'm trying to use software flow control by sending XON and XOFF values. But still, the data is missing.
I'm sending XON before reading data and I'm sending XOFF immediately after data reading. Is this the correct way of using this? or Do I have to initialize something for software flow control?
Also please let me know if there is any alternative solution for downloading the file using the cellular modem and saving it in the partition.
Thanks.
Now when I'm reading the data from UART and printing it, I'm receiving all the data properly. But when I'm trying to store the downloaded content into a local file in the file system. Data is being missed. I understood that this UART task should be performed uninterrupted.
For this, I tried running file writing tasks separately using xSemaphoreCreateMutex() but still the data is missing.
Now I'm trying to use software flow control by sending XON and XOFF values. But still, the data is missing.
I'm sending XON before reading data and I'm sending XOFF immediately after data reading. Is this the correct way of using this? or Do I have to initialize something for software flow control?
Also please let me know if there is any alternative solution for downloading the file using the cellular modem and saving it in the partition.
Thanks.