Skip to content

Status Code 200 Received but New Program Not Loaded #163

Closed

Description

@JEG8

Hi,

I am running into an issue on my Arduino IOT 33 where the OTA downloads the file and I receive a 200 status code, but the file is not replaced on the device. The old file is loaded back on. Do you know why this is happening? Could it be check sum related? The performance is very inconsistent.

Joe

Activity

  1. JAndrassy commented on Jul 14, 2022

    @JAndrassy
    Owner

    there is no checksum.
    how do you test if the new or old version is running?

  2. JEG8 commented on Jul 14, 2022

    @JEG8
    Author

    I have a firmware version number that gets updated when I add a new version to my server. Also, I can see that when I make edits to print statements, they do not show up on the serial monitor, indicating that the new version was never loaded on. However, I can see that the download occurs correctly because the size of the file matches the BIN output of the IDE.

  3. JAndrassy commented on Jul 15, 2022

    @JAndrassy
    Owner

    you use InternalStorage directly?

  4. JEG8 commented on Jul 15, 2022

    @JEG8
    Author

    No, I don't know what you mean by "InternalStorage". I am saving the downloaded file to a SPI Flash. I am then checking the size of the file, and comparing it to the "length" returned by the server. If they match, I proceed with the update. That all works fine. However, it appears that the bootloader portion isnt working properly. The file is not replaced on the hardware.

  5. JAndrassy commented on Jul 15, 2022

    @JAndrassy
    Owner

    so you don't use the ArduinoOTA library at all.
    you download the file to external SPI flash and it should be bootloaded by what? I don't know about a library similar to SDU library, which would load the update binary from SPI flash as the SDU library does from SD card

  6. JEG8 commented on Jul 15, 2022

    @JEG8
    Author

    Is the SDU library strictly for SD card? I am using Adafruit library which can be used with either an SD card or a SPI Flash. I figured because they both use SDFat library, they could be used interchangeably and the update would still work with the SDU library.

  7. JAndrassy commented on Jul 15, 2022

    @JAndrassy
    Owner

    SDU library is just an array set to be prepended by the linker before your sketch. And that array is a compiled extra sketch which loads the binary from SD card, writes it to flash and hands over the execution to regular sketch. It knows nothing about your SPI flash or the Adaruit_SPIFlash libray.

  8. JEG8 commented on Jul 15, 2022

    @JEG8
    Author

    Hi,

    I should clarify, when I say SPIFlash - I am using a Winbond W25Q128JVSIM flash memory in place of an SD Card (to save space).

    I think you pointed me to the right location. It looks like the SDU Library uses the following on (Line 49 SDUBoot.INO) to look for the update file on the SD Card.

    if (SD.begin(SDCARD_SS_PIN) && SD.exists(UPDATE_FILE)) {
    File updateFile = SD.open(UPDATE_FILE);
    uint32_t updateSize = updateFile.size();
    bool updateFlashed = false;

    That file is actually on my SPI Flash, stored the same way. I should just need to point the SDU to look at my SPI Flash for the file, right?

  9. JAndrassy commented on Jul 15, 2022

    @JAndrassy
    Owner

    That file is actually on my SPI Flash, stored the same way. I should just need to point the SDU to look at my SPI Flash for the file, right?

    right. you have to write and test the modified 'extras' sketch which will use the SPFlash library instead of the SD library. Then you have to convert the compiled binary of that sketch to an array of bytes in a .h file (there is some tool I found long time ago on Internet which can help with it). Then you create a library with that .h file and use it with your sketch.

  10. Repository owner locked and limited conversation to collaborators on Jul 15, 2022
  11. converted this issue into a discussion #164 on Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions