Portenta H7 Lite: Unable to initialize QSPI-BlockDevice

Hey everyone,

I need to permanently save data for user settings. I've been using the included QSPI-Flash to achieve this and so far it has worked great.

The Problem:
I own a total amount of 5 Arduino Portenta H7.

  • 1 Portenta H7 (bought in 2021) + 1 Portenta H7 Lite (bought in April 2022). I'll refer to those as "older" boards.
  • 3 Portenta H7 Lite (bought in December 2022). I'll refer to those as "newer" boards.

When I tried to Flash my existing code (which worked on the "older" boards) to the "newer" boards, everything except the QSPI-Flash worked. I simply couldn't read, store or erase data. This problem occurs on all three (!) of the "newer" boards.

In order to find the error I made this simple sketch, based on THIS tutorial:

//QSPI-Flash test
#include "QSPIFBlockDevice.h"
#include "MBRBlockDevice.h"

using namespace mbed;

#define BLOCK_DEVICE_SIZE 1024*8    //Define 8KB Partition Size
#define PARTITION_TYPE 0x0B         //Define Partition Type as FAT32



void setup(){

  HAL_Init();

  int initStatus=0;
  uint64_t eBS=0, pBS=0, rBS=0;   //Erase-BlockSize | Program-BlockSize | Read-BlockSize

  
  Serial.begin(9600);
  while(!Serial);      //Wait for Serial port 


  //Create Block Device
  QSPIFBlockDevice root(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000);
  MBRBlockDevice blockDevice(&root, 1);


  //Block-Device initialisation
  if(blockDevice.init() != 0 || blockDevice.size() != BLOCK_DEVICE_SIZE){
    Serial.println("\n\nPartitioning block device...\n");
    blockDevice.deinit();
    MBRBlockDevice::partition(&root, 1, PARTITION_TYPE, 0, BLOCK_DEVICE_SIZE);
    initStatus = blockDevice.init();  //<-- Returns -4002 when using "newer" boards.
  }


  //Get Block-sizes
  eBS = blockDevice.get_erase_size();
  pBS = blockDevice.get_program_size();
  rBS = blockDevice.get_read_size();


  //Write returned Values to Serial
  Serial.println("-------- Results of QSPI Block Device Test --------");
  Serial.println("Init status: " + String(initStatus));
  Serial.println("Erase block size: " + String((int)eBS));
  Serial.println("Program block size: " + String((int)pBS));
  Serial.println("Read block size: " + String((int)rBS));
  Serial.println("---------------------------------------------------");
}


//Not used in this sketch :)
void loop(){
}

I compiled this code both in Arduino IDE 1.8.19 and VSCode (PlatformIO), both yield the same results:

Serial monitor output using an "older" Portenta H7 Lite:
LOG_OK

Serial monitor output using a recently bought Portenta H7 Lite:
LOG_ERROR

As you can see, when I'm trying to initialize the blockDevice, it returns an error code (-4002). As a result, I can't erase, program or read data.

To Summarize:

  • QSPI-Flash works on Portenta H7 boards I've bought more than half a year ago (April 2022)
  • QSPI-Flash doesn't work on Portenta H7 boards I've bought in December 2022
  • Initialization returns an Error-Code (-4002) on "newer boards"

Questions:

  • Has the Hardware changed (different Pins for QSPI, etc.)?
  • Is there anyone who has/had the same problem?

Any help is greatly apprechiated

Thanks,
Thomas

You have this one, that one, one from last year etc. Post links to "Technical Information" on each of these and any model and revision numbers. An annotated schematic would be helpful, if it is a frizzy forget it.