Skip to content

MX25L12833F

The Renesas-Arduino core includes a built-in FATFileSystem library to control the QSPI flash memory. This example code demonstrates how to initialize the flash memory, a file is written, and data is read from the file. Users can also find other example sketches in the File > Examples > Storage drop-down menu.

QSPI_Flash_FileSystem_Test.ino

ESLOV Connector

The Portenta C33 board features an onboard ESLOV connector to extend the I2C communication bus. This connector simplifies connecting various sensors, actuators, and other modules to the Portenta C33 without soldering or wiring; Nicla family boards can also be connected to the Portenta C33 through this connector.

Portenta C33 built-in ESLOV connector

The ESLOV connector is a small 5-pin connector with a 1.00 mm pitch. The mechanical details of the connector can be found in the connector's datasheet.

The pin layout of the ESLOV connector is the following:

  1. VCC
  2. INT
  3. SCL
  4. SDA
  5. GND

VCC pin works as a 5 V output if the board is connected to a USB-C® cable. The manufacturer part number of the ESLOV connector is SM05B-SRSS, and its matching receptacle manufacturer part number is SHR-05V-S-B.

External Memory

The Portenta C33 board features an onboard 16 MB QSPI Flash memory, the MX25L12833F from Macronix®. Having an onboard QSPI Flash memory enhances the capabilities of the Portenta C33, enabling you to develop and run more complex and data-intensive applications.

Onboard QSPI Flash memory of the Portenta C33 board

Some key advantages of having an onboard QSPI Flash memory are the following:

  • Storage capacity: The MX25L12833F QSPI Flash memory adds significant non-volatile storage to the board.
  • Extended functionality: The additional memory space allows more complex applications to be developed and run on your Portenta C33. This application includes data logging, image processing, audio processing, and executing complex algorithms.
  • Firmware updates: The MX25L12833F QSPI Flash memory can also store firmware or software updates for your Arduino board. This means you can update the firmware without requiring a complete reprogramming of the board.

The Arduino Renesas Core has built-in libraries and drivers that immediately let you use the onboard QSPI Flash memory. Let's walk through an example code demonstrating some of the onboard Flash memory capabilities; the main tasks performed in the sketch are initializing the Flash memory, writing to a file, and reading from a file.

```arduino /** QSPI Flash File System test Name: QSPI_Flash_FileSystem_Test.ino Purpose: This sketch test the onboard QSPI Flash memory file system by writing and reading a file.

@author Arduino Team @version 1.0 20/06/23 */

// Include necessary libraries and drivers

include "QSPIFlashBlockDevice.h"

include "FATFileSystem.h"

// Define constants for file system and test file name

define QSPI_FS_NAME "qspi"

define TEST_FILE "test.txt"

// Instantiate flash block device and file system QSPIFlashBlockDevice block_device(PIN_QSPI_CLK, PIN_QSPI_SS, PIN_QSPI_D0, PIN_QSPI_D1, PIN_QSPI_D2, PIN_QSPI_D3); FATFileSystem fs(QSPI_FS_NAME);

// Define full path to the test file std::string file_test_name = std::string("/") + std::string(QSPI_FS_NAME) + std::string("/") + std::string(TEST_FILE);

void setup() { // Initialize serial communication and wait a connection Serial.begin(9600); while(!Serial);

// Print test start message Serial.println(); Serial.println("- SIMPLE QSPI FLASH TEST"); Serial.println();

// Try to mount the QSPI Flash file system // If mounting fails, try to format the file system int err = fs.mount(&block_device); if (err) { Serial.println("- No filesystem found, formatting... "); err = fs.reformat(&block_device); } if (err) { // If formatting fails, print error and halt Serial.println("- Error formatting QSPI Flash "); while(1); }

// Try to open a test file for writing // If file opened successfully, write some text to the file FILE* fp = fopen(file_test_name.c_str(), "w"); if(fp != NULL) {

// Always close the file after writing to save changes

??? code
    ```cpp
      Name: QSPI_Flash_FileSystem_Test.ino
      Purpose: This sketch test the onboard QSPI Flash memory
      file system by writing and reading a file.

      @author Arduino Team
      @version 1.0 20/06/23
    */

    // Include necessary libraries and drivers
    #include "QSPIFlashBlockDevice.h"
    #include "FATFileSystem.h"

    ```

fclose(fp);

??? code
    ```cpp
    #define QSPI_FS_NAME "qspi"
    #define TEST_FILE "test.txt"

    // Instantiate flash block device and file system
    QSPIFlashBlockDevice block_device(PIN_QSPI_CLK, PIN_QSPI_SS, PIN_QSPI_D0, PIN_QSPI_D1, PIN_QSPI_D2, PIN_QSPI_D3); 
    FATFileSystem fs(QSPI_FS_NAME);

    // Define full path to the test file
    std::string file_test_name = std::string("/") + std::string(QSPI_FS_NAME) + std::string("/") + std::string(TEST_FILE); 

    void setup() {
      // Initialize serial communication and wait a connection
      Serial.begin(9600);
      while(!Serial);

    ```

}

??? code
    ```cpp
    Serial.println();
    Serial.println("- SIMPLE QSPI FLASH TEST");
    Serial.println();

    // Try to mount the QSPI Flash file system
    // If mounting fails, try to format the file system
    int err =  fs.mount(&block_device);
    if (err) {
      Serial.println("- No filesystem found, formatting... ");
      err = fs.reformat(&block_device);
    }
    if (err) {
      // If formatting fails, print error and halt
      Serial.println("- Error formatting QSPI Flash ");
      while(1);
    }

    ```