JAndrassy / ArduinoOTA

Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries
GNU Lesser General Public License v2.1
435 stars 89 forks source link

arduino uno r4 wifi error Serial.println("There is not enough space to store the update. Can't continue with update."); #250

Closed brsbnkc closed 2 months ago

brsbnkc commented 2 months ago

I am reaching out regarding an issue I encountered while using the ArduinoOTA library.

I am currently working with an Arduino Uno R4 WiFi board and attempting to implement OTA updates using your library. However, I am encountering an error message stating "There is not enough space to store the update. Can't continue with update." Despite the fact that the downloaded file size (172140 bytes) is smaller than the maximum program storage space on the board (262144 bytes), I am still encountering this issue.

I have thoroughly checked the memory usage and the size of the downloaded file, and everything seems to be in order. I have also reviewed my code for any potential memory-consuming operations but couldn't find any.

Could you please assist me in resolving this issue or provide any insights into what might be causing it? Any help or suggestions would be greatly appreciated.

Thank you very much for your time and assistance.

JAndrassy commented 2 months ago

the library uses upper half of the flash memory to store the update binary. after the upload the binary is copied to the run location in the lower half of the flash memory

brsbnkc commented 2 months ago

Could you please provide guidance on how to effectively resolve this issue? Specifically, I would like to know if there are any recommended steps or configurations to ensure sufficient space is available in the upper half of the flash memory during the update process.

JAndrassy commented 2 months ago

I wonder why is your sketch so large? If the sketch is bigger than half of the flash, you could use SD card with SDStorage and SDU library.

brsbnkc commented 2 months ago

My code hosts several libraries and facilitates RESTful API communication. Additionally, I have a device equipped with an HMI (Human-Machine Interface) screen, which contributes to the larger size of the code file. The device comes with an SD card, and I aim to perform updates over the internet. Is it possible to download the file from the internet and update it via the SD card?

Are there any limitations or challenges I should be aware of in this regard? Do you have any suggestions or alternative solutions? Can you share an example? Thank you.

JAndrassy commented 2 months ago

please read the README https://github.com/JAndrassy/ArduinoOTA/blob/master/README.md#contents and see the Advanced section in Examples

brsbnkc commented 2 months ago

Investigated the file you specified but couldn't find anything helpful. What I want to do is to download a binary file from the internet and copy it to an SD card, and then perform the update process from the file on the SD card. Can I do this? Could you provide an example?

JAndrassy commented 2 months ago

In advanced section of examples you can find examples of sketch update over download from a http server. One example shows update over the InternalStorage object of the ArduinoOTA library. The example for update over SD card doesn't use this library at all.

brsbnkc commented 2 months ago

Then I guess I won't be able to update via OTA using this library.

JAndrassy commented 2 months ago

this library was created for upload from IDE. additionally the InternalStorage objects can be useful with other transports if flash is used as storage. the SD way is supported by the SDU library, which I ported for Uno R4 (and it was a lot of work to make it small)

brsbnkc commented 2 months ago

SD.remove("UPDATE.bin"); File file = SD.open("UPDATE.bin", O_CREAT | O_WRITE); if (!file) { client.stop(); Serial.println("Bin file could not be created. The update will continue."); return; } byte b; while (length > 0) { if (!client.readBytes(&b, 1)) break; file.write(b); length--; } file.close();

I am uploading it to the SD Card with this code, but how do I get the file from the SD card and update it?

JAndrassy commented 2 months ago

SDU library does it on restart. but both sketches must include it. (and the SD card wiring must match the one required by the SDU library) https://github.com/arduino/ArduinoCore-renesas/blob/main/libraries/SDU/examples/Usage/Usage.ino