Accessing XIAO BLE Sense (nRF52840)'s onboard QSPI flash through non-mbed board

Hi all,
I want to store a string in XIAO BLE Sense nRF52840’s onboard 2MB flash. I know it is possible using mbed-boards but I also wanted to try with non-mbed…
While browsing the nRF52 folder on my laptop I found “C:\Users\user_name\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp”
And based on it, I wrote-

#include <stdio.h>
#include <string.h>
#include <Adafruit_FlashTransport.h>
#include <nrfx_qspi.h>

// Create an instance of the QSPI flash transport
Adafruit_FlashTransport_QSPI flashTransport(24,25,26,27,28,29); //pin numbers from variant.h

const uint32_t flashAddress = 0x00000000;
const char dataToWrite[] = "Hello";
char dataRead[sizeof(dataToWrite)] = {0};

void setup() {
  // Initializing Serial
  while (!Serial) {

  // Initializing QSPI flash

  // Erasing the data in the flash memory before write
  if (flashTransport.eraseCommand(SFLASH_CMD_ERASE_SECTOR, flashAddress)) {
    Serial.println("4KB data erased successfully!");
  } else {
    Serial.println("Failed to erase data in flash.");

  // Writing the data to the flash memory
  if (flashTransport.writeMemory(flashAddress, (uint8_t*)dataToWrite, sizeof(dataToWrite))) {
    Serial.println("Data written to flash successfully!");
  } else {
    Serial.println("Failed to write data to flash.");

  // Reading the data back from the flash memory
  if (flashTransport.readMemory(flashAddress, (uint8_t*)dataRead, sizeof(dataToWrite))) {
    Serial.print("Data read from flash: ");
  } else {
    Serial.println("Failed to read data from flash.");

void loop() {
  // Idle loop

However, this returned-
4KB data erased successfully!
Failed to write data to flash.
Data read from flash: ������

What am I missing?
Thanks for your attention.