TinyGSM icon indicating copy to clipboard operation
TinyGSM copied to clipboard

OTA Problem (help)

Open lucasromeiro opened this issue 2 years ago • 6 comments

Hi guys, I have a problem.

I use esp32 and a sim800l modem. I need to do OTA update safely, so there is no risk of a device breaking with a failed update. However, apparently the tinygsm communication object is not supported for the standard OTA update function. I have a large program, almost 1mb of code. I looked at people downloading the BIN file for SPIFFS and then updating. Is this 100% safe? Is there a risk of failure and killing equipment that is remote? I tried to implement it but I couldn't because the . BIN is too big.

Maybe if I change the file system to 1M of program and 3M of SPIFFS. It is possible?

If there is another way, can you help me?

lucasromeiro avatar Jan 27 '22 11:01 lucasromeiro

Can I ask you if its is a HTTP or HTTPS request you are doing?

zark-zeugan avatar Feb 13 '22 12:02 zark-zeugan

I have the same problem: with the 800KB file bin I haven't any problem, but with 1MB file BIN the download fails. What's the problem?

salvatorescarantino avatar Feb 15 '22 19:02 salvatorescarantino

Can I ask you if its is a HTTP or HTTPS request you are doing?

http

lucasromeiro avatar Feb 15 '22 19:02 lucasromeiro

Can I ask you if its is a HTTP or HTTPS request you are doing?

http

me too

salvatorescarantino avatar Feb 15 '22 19:02 salvatorescarantino

I've solved the problem: the main problem isn't the http request, but the writing of spiffs. In the example sketch there's a single while command that writing that client read. In this case at the end of download the command not work correctly and the while command stops. I've made 3 fix:

  1. File file = SPIFFS.open("/update.bin", FILE_WRITE); --->I've change FILE_APPEND in FILE_WRITE
  2. I've add more while command during download bin file;
  3. Added a delay of 500ms in every serial transmission of percent.

Try it

salvatorescarantino avatar Feb 15 '22 20:02 salvatorescarantino

I've solved the problem: the main problem isn't the http request, but the writing of spiffs. In the example sketch there's a single while command that writing that client read. In this case at the end of download the command not work correctly and the while command stops. I've made 3 fix:

  1. File file = SPIFFS.open("/update.bin", FILE_WRITE); --->I've change FILE_APPEND in FILE_WRITE
  2. I've add more while command during download bin file;
  3. Added a delay of 500ms in every serial transmission of percent.

Try it

@salvatorescarantino Could you share a snippet of the code? Also, what server are you using to store your binaries?

zark-zeugan avatar Feb 16 '22 03:02 zark-zeugan

Any update on this?

gotnull avatar Jan 14 '23 09:01 gotnull