Portenta H7 Lite QSPI flash failure

I was unable to run the standard Portenta H7 examples QSPIFormat and AccessFlashAsUSBDisk. Something went wrong in the creation of the QSPIFBlockDevice.

After I installed the QSPIFBlockDevice code in the installation tree I found out that in QSPIFBlockDevice::_sfdp_parse_basic_param_table it discovers that shouldSetQuadEnable=true, is_qpi_mode=false and _needs_fast_mode=true but then fails to set the flash to QPI mode and bails out with an error. Once I commented out the lines after “// Detect and Set fastest Bus mode (default 1-1-1)” everything started working albeit a bit slow (1-1-1 not 4-4-4).

This is with the MX25L12833FZ2I-100 flash. The Portenta MBED-OS version is v3.4.1 and the source code of QSPIFBlockDevice and SFDP that I used for debugging and fixing is from v6.16.0. The 3.4.1 version is what you get when installing the Portenta H7 BSP from the Arduino 1.8 environment.

It seems like there is a bug though I don’t know if it is with the flash or MBED-OS or with how the standard example is set up. Thanks for your help in advance.