Learn how to reset or change the QSPI flash memory configuration on STM32H747-based Arduino boards using a utility sketch. Running the sketch erases any custom partitioning, restores one of two supported memory layouts, and reinstalls the latest connectivity firmware along with TLS certificates.
You may want to use this procedure to:
- Switch between different partition schemes.
- Recover a board with incorrectly partitioned memory.
- Resolve other issues with memory or connectivity.
In this article:
- Available partition schemes
- Use the default partition scheme
- Use the partition scheme for Arduino PLC IDE (Legacy)
- Troubleshooting
Available partition schemes
| Partition scheme | Description |
|---|---|
| Default partition scheme | Required for full Arduino Cloud support. Supports PLC IDE on Arduino Opta. |
| Arduino PLC IDE (Legacy) | Use this scheme to make Portenta Machine Control compatible with PLC IDE. |
Use the default partition scheme
This partition scheme supports the latest Arduino Cloud features, and is recommended for all supported devices (including Arduino Opta when used with PLC IDE).
Supported devices:
- Arduino GIGA R1 WiFi
- Arduino Opta Lite
- Arduino Opta RS485
- Arduino Opta WiFi
- Arduino Portenta H7
- Arduino Portenta H7 Lite
- Arduino Portenta H7 Lite Connected
- Arduino Portenta Machine Control
Follow these steps:
-
Open the memory partitioning sketch:
-
Arduino IDE: Ensure that you are using the latest version of the board package, then select File > Examples > STM32H747_System > QSPIFormat.
-
GitHub: Download the QSPIFormat example and open it on Arduino IDE or Arduino Cloud.
-
-
Connect your device to your computer and select the device in the editor.
-
Click
Upload to upload the sketch to the device.
-
Click the
Serial Monitor button in the top-right corner or select Tools > Serial Monitor (Arduino IDE only).
-
You should see the text below in the serial monitor. If the serial monitor is empty, ensure the sketch has finished uploading and press the RST button on the device to restart the sketch.
WARNING! Running the sketch all the content of the QSPI flash will be erased. The following partitions will be created: Partition 1: WiFi firmware and certificates 1MB Partition 2: OTA 5MB Partition 3: Provisioning KVStore 1MB Partition 4: User data / OPTA PLC runtime 7MB Do you want to proceed? Y/[n] -
Type “Y” into the Serial Monitor and press Enter to proceed.
-
The following should now appear in the serial monitor:
Do you want to perform a full erase of the QSPI flash before proceeding? Y/[n] Note: Full flash erase can take up to one minute.Type “Y” into the Serial Monitor and press Enter to confirm (recommended).
-
The following should now appear in the serial monitor:
Do you want to restore the WiFi firmware and certificates? Y/[n]Type “Y” into the Serial Monitor and press Enter to confirm (recommended).
-
The following should now appear in the serial monitor:
Do you want to use LittleFS to format user data partition? Y/[n] If No, FatFS will be used to format user partition. Note: Arduino PLC IDE is using LittleFS to store runtime data on this partition.Type “Y” into the Serial Monitor and press Enter to confirm (recommended).
-
The process is complete when this message appears in the serial monitor:
QSPI Flash formatted!
It's now safe to reboot or disconnect your board.
Use the partition scheme for Arduino PLC IDE (Legacy)
This partition scheme is for Portenta Machine Control users that want to use the board with Arduino PLC IDE:
-
Download the following sketch:
-
Open the sketch in your editor:
-
Arduino IDE: Extract the .zip into your Sketchbook. Ensure both
memory_partitioning.inoandcertificates.hare inside a folder namedmemory_partitioning. -
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
memory_partitioning.zip.
-
-
Open the imported sketch in your editor.
-
Connect your device to your computer and select the device in the editor.
-
Click
Upload to upload the sketch to the device. The partitioning and firmware update process will begin automatically when the sketch starts running.
-
Click the
Serial Monitor button in the top-right corner or select Tools > Serial Monitor (IDE only).
-
Open the Serial Monitor. When this message appears, the process is complete:
Firmware and certificates updated! It's now safe to reboot or disconnect your board.
Note that resetting the flash memory will remove the PLC IDE runtime. To continue using PLC IDE with your device, you need to reinstall the runtime. After seeing the completion message, if you plan to reinstall the runtime, it is recommended to put the board in bootloader mode by double-tapping the RST button before opening the PLC IDE. If you reboot or reconnect the board normally while the partitioning sketch is still loaded, it will automatically format the memory again without asking for confirmation.
Troubleshooting
-
If you’re using an Arduino Opta and still encounter issues, the memory may have write protection enabled. Follow the instructions in Recover an Arduino Opta with read-only flash memory, then partition the memory again.
-
If you are using a Portenta Machine Control and experience connection issues with the PLC IDE (for example, a blinking red LED), try the Legacy partition scheme.