Skip to content

Commit

Permalink
Merge branch 'main' into aliphys/addReleaseVersionCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
aliphys authored Nov 17, 2023
2 parents 748693f + 7739373 commit 6f866f9
Show file tree
Hide file tree
Showing 34 changed files with 2,370 additions and 1,265 deletions.
1 change: 1 addition & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
- source-path: ./
- name: Arduino_USBHostMbed5
- name: Arduino_POSIXStorage
- name: ArduinoRS485
# Additional library dependencies can be listed here.
# See: https://github.com/arduino/compile-sketches#libraries
sketch-paths: |
Expand Down
43 changes: 42 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,47 @@
"unordered_map": "cpp",
"vector": "cpp",
"string_view": "cpp",
"initializer_list": "cpp"
"initializer_list": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"typeinfo": "cpp",
"cerrno": "cpp"
}
}
56 changes: 33 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,60 @@

The Arduino_UnifiedStorage library provides a unified interface to access different types of storage, including internal storage, SD cards, and USB mass storage devices. It simplifies the handling of files and directories across multiple storage mediums on Portenta, Opta, and some Nicla boards.


## Examples

* [**examples/SimpleStorageWriteRead**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/SimpleStorageWriteRead/SimpleStorageWriteRead.ino) - Write/read simple data from SD, USB and internal storage

* [**examples/AdvancedUSBInternalOperations**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/AdvancedUSBInternalOperations/AdvancedUSBInternalOperations.ino) - Navigate file structure and demonstrate file operations between USB and internal storage

* [**examples/BackupInternalPartitions**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/BackupInternalPartitions/BackupInternalPartitions.ino) - Back up all partitions on the internal storage to a USB Mass Storage device.

* [**examples/Logger**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/Logger/Logger.ino) - This example demonstrates how you can log sensor data into its internal storage and detect the insertion of a USB drive. When a USB drive is connected, it selectively transfers only the new data to the USB mass storage device. Even if you remove the USB drive, the device continues to log data in its internal storage. This capability is particularly valuable for accumulating training data required for embedded machine learning applications.

* [**examples/InternalStoragePartitioning**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/InternalStoragePartitioning/InternalStoragePartitioning.ino) - Demonstrates how you can use the Arduino_UnifiedStorage library to create and read partitions on the Internal QSPI Storage.

## 👀 Instructions
1. Download and install this library

1. Download and install this library
2. Check compatibility with your platform
3. To use internal storage, you need to make sure it is partitioned and formatted correctly:

### Formatting the Portenta H7 / Portenta Machine Control / Opta Internal Storage
* Flash the `QSPIFormat` example that can be found in the `STM32H747_System` folder
* Open the serial monitor and select answer with "n" when this appears "Do you want to use partition scheme 1? Y/[n]"
* The sketch will warn you that the content of the QSPI flash will be erased. Answer with "Y".
* When asked if you'd like to use LittleFS on the data partition, select "n". Most of the examples assume that the drive is formatted as FAT. You can use the library to format to LittleFS later.
* Reboot the board

### Formatting the Portenta C33 Internal Storage
* Flash the `QSPIFormat` example that can be found in the `Storage` folder for Portenta C33.
* Open the Serial Monitor. The sketch will warn you that the content of the QSPI flash will be erased. Answer with "Y".
* When asked if you'd like to use LittleFS on the data partition, select "n". Most of the examples assume that the drive is formatted as FAT. You can use the library to format to LittleFS later.
* Reboot the board
3. Check out the examples or read read the documentation [here](./docs).

## ✨ Features

* Access files and directories on internal storage, SD cards, and USB mass storage devices.
* Read and write data to files.
* Create, remove, and rename files and directories.
* Copy and move files and directories.
* List files and subfolders in a directory.
* Manipulate files and folders from one storage medium to another
* Format partitions and drives (FAT and LittleFS)
* Create and modify partitions on the internal storage
* Register callbacks whenever a USB Mass Storage device has been inserted or removed
* Get verbose output of every action the library performs for seamless debugging

## Compatibility

This library has been tested with the following STM32 and Renesas based Arduino boards. The availability of storage mediums depends on the hardware interfaces:
* Portenta Machine Control: USB and Internal QSPI Flash
* Portenta H7 + Portenta Breakout: USB, SD, and QSPI
* Portenta H7 + Vision Shield: SD and QSPI
* Portenta C33 + Portenta Breakout: USB, SD, and QSPI
* Portenta C33 + Vision Shield: SD and QSPI
* Opta: Internal QSPI Flash and USB

* **Portenta Machine Control**: USB and Internal QSPI Flash
* **Portenta H7 + Portenta Breakout**: USB, SD, and QSPI
* **Portenta H7 + Vision Shield**: SD and QSPI
* **Portenta C33 + Portenta Breakout**: USB, SD, and QSPI
* **Portenta C33 + Vision Shield**: SD and QSPI
* **Opta**: Internal QSPI Flash and USB


The library allows you to connect a USB drives in a couple of different ways:

* **Use the USB-C port on the board**: Ensure Serial functionality is not in use on the same port to prevent conflicts.
* **Connect to the USB-A port**: Located on the Portenta Breakout
* **Use a USB Hub**: Note that while our some USB Hubs are supported, we cannot ensure compatibility with all USB Hubs. Especially for when used together with advanced features like Ethernet or HDMI, such as certain USB-C hubs.

**Note:** Due to the extremely large selection of USB Mass Storage devices on the market, we cannot guarantee compatibility with your USB thumb drive. However, we had great results with drives from reputable brands such as Kingston, SanDisk, Samsung, etc.

**Note:** Due to an unforeseen compatibility issue on the Portenta Breakout Board, inserting a USB drive on the USB-A port of the breakout board may occasionally cause a reboot on Portenta C33 boards. You can work around this issue by connecting your USB Mass Storage device through a USB hub. Please note that the USB Callback functionality on the Portenta C33 boards might also be affected by this issue.

Note: Due to an unforeseen compatibility issue on the Portenta Breakout Board, inserting a USB drive on the USB-A port of the breakout board may occasionally cause a reboot on Portenta C33 boards. You can work around this issue by connecting your USB Mass Storage device through a USB hub. This limitation only affects Portenta C33 boards.
This limitation only affects Portenta C33 boards.

## 📖 Documentation

Expand Down
Loading

0 comments on commit 6f866f9

Please sign in to comment.