ESP-AT Abort Serial Data transfer (after '>' character)

Tonino
Posts: 4
Joined: Mon Oct 24, 2022 8:30 am

ESP-AT Abort Serial Data transfer (after '>' character)

Postby Tonino » Mon Oct 24, 2022 8:39 am

Hi,
I'm using the ESP-AT firmware on an ESP32 chip.
I'm unable to find any method to cancel/abort the serial data transfer after getting the usual '>' character
This is used in commands like AT+HTTPCPOST or AT+BLEGATTSNTFY.
Sometimes an error might be detected after starting the direct data transfer and I can't see any way to abort the transfer.
Right now the only way is by sending the required number of characters specified in the source AT command
(ie:

Code: Select all

AT+HTTPCPOST="http://httpbin.org/post",427,2,"connection: keep-alive","content-type: application/json"
)
This would expect 427 chars.

If an error occurs while sending the data (ie: file read error) what should i do to go back to the normal AT mode?
The documents don't specify how to deal with this situation and google didn't help either.

Thanks in advance.

Toni

ESP_Sun
Posts: 320
Joined: Thu Dec 30, 2021 9:52 am

Re: ESP-AT Abort Serial Data transfer (after '>' character)

Postby ESP_Sun » Tue Oct 25, 2022 6:23 am

Hi,

After the normal ">" character is obtained in the AT+HTTPCPOST or AT+BLEGATSNTFY command, there is no other method to cancel/stop the serial data transmission except sending data of sufficient length. Can you tell me what kind of scenarios you need this function? Maybe we can see together whether we can do some operations on the MCU side to achieve this function?

Tonino
Posts: 4
Joined: Mon Oct 24, 2022 8:30 am

Re: ESP-AT Abort Serial Data transfer (after '>' character)

Postby Tonino » Wed Oct 26, 2022 5:40 am

Hi, I'm just using HTTP Post to send some data to a Host for processing.
Data is stored on a file. I experienced some errors when accessing the data that left the ESP32 blocked due to lack of data.

Of course I could just send 0 until I reach the limit, but that would just send garbage to the server which I'd like to avoid.
It would be good to have a special character to cancel the transaction or at least some short timeout that would allow me to just wait to cancel.
I've used the exact same method on other devices and there I had the option to cancel with a special char (ie: ESC)

Any suggestions will be appreciated.

BR

esp-at
Posts: 177
Joined: Mon May 09, 2022 3:00 am

Re: ESP-AT Abort Serial Data transfer (after '>' character)

Postby esp-at » Fri Oct 28, 2022 6:28 am

Here are possible two suggestions.
1. Use AT+CIPSENDL command instead. you can use +++ to cancel the data transmission at any time. but you have to construct a HTTP POST packet on your MCU, and send it by AT+CIPSENDL command.
2. Before you send AT+HTTPCPOST, data should be ready to send. is it possible to add some check before you send AT+HTTPCPOST.

Tonino
Posts: 4
Joined: Mon Oct 24, 2022 8:30 am

Re: ESP-AT Abort Serial Data transfer (after '>' character)

Postby Tonino » Thu Nov 03, 2022 7:35 am

Hi,
I'll probably go with #2.
I wanted to prevent that because my free memory is pretty low and this will involve reading the file beforehand and storing the data to send, but I guess that's the way to go.
Building the HTTP POST on my side will be more complex and will spend even more memory, so that's out of the question at this point.

Anyway, it would be really great having a way to cancel the data entry in future releases.

Thx for the help.

Who is online

Users browsing this forum: No registered users and 13 guests