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

Grand Central M4 (SAMD51) writing to flash corrupted #201

Open hydrofoor opened 1 year ago

hydrofoor commented 1 year ago

It appears the eraseFlash() function for SAMD51 is not correct. When trying to flash sketches to an Adafruit Grand Cental M4 Express board (through WifiEspAt) the data written to flash was corrupted. After some searching I found in the SAM D5x datasheet 'The NVM <...> is organized into blocks, where each block contains sixteen pages' and as the memory is to be erased in blocks before writing the the attached patch was applied. Then upload and flash was successful.

InternalStorage.cpp.patch