In certain situations, the QSPI flash memory on the Arduino Opta may become configured as read-only.
The QSPI flash is likely read-only if:
- You are unable to erase or overwrite the QSPI flash memory.
- You encounter an
Error formatting OTA partition
message when attempting to partition the memory.
The write protection can be removed by uploading a recovery sketch.
Follow these steps:
-
Download or copy the unlockOptaNORFlash.ino[1] sketch from GitHub.
-
Open the sketch in your editor:
-
In Arduino IDE, do one of the following:
- Create a new sketch and paste the entire unlockOptaNORFlash sketch into the editor.
- Copy the .ino file into your Sketchbook. Ensure that
unlockOptaNORFlash.ino
is inside a folder namedunlockOptaNORFlash
.
-
In Cloud Editor, open the Sketches tab and click on the Create button in the top-right corner. Select Import local file in the dropdown menu and import
unlockOptaNORFlash.ino
.
-
-
Connect your Opta to your computer and select it in the editor. If your Opta does not appear on a port, press the RESET button twice in quick succession.
-
Upload the sketch.
-
Click the
Serial Monitor button in the top-right corner or select Tools > Serial Monitor (IDE only).
-
The process is complete when the line
---end---
appears in the serial output.
-
The sketch works by reinitializing the QSPI and configuring the hardware protection data pin as a GPIO input. The internal pull-up resistor of the QSPI flash is then used to deactivate the hardware flash protection. Through this approach, writing can be enabled, and the protection bits can be reset. Learn more about the procedure here. ↩︎