Seed QSPI example

Hello,

Has anyone run DaisyExamples/seed/QSPI/QSPI.cpp lately?

I tried it and it ends in a hard fault.
I instrumented the code a little

    hw.qspi_handle.mode = DSY_QSPI_MODE_DSY_MEMORY_MAPPED;
    res = dsy_qspi_init(&hw.qspi_handle);

    if (res != DSY_MEMORY_OK)
        asm("bkpt 255");

and the breakpoint is getting triggered.

Anyone got a working example of reading the QSPI in memory mapped mode after having written something that they’d care to share?

Cheers

I haven’t updated my libdaisy for some weeks, but here is my code. I don’t even check the result from dsy_qspi_init() :slight_smile:

static OpdFlashConfig DSY_QSPI_BSS flashConfigLoad;

void UtilFlashSave()
{
uint32_t base = 0x90000000;
OpdFlashConfig flashConfigSave;

// copy data to flashConfigSave struct

flashConfigSave.configVersion = FLASH_CONFIG_VERSION;

// init and set mode

hardware.qspi_handle.mode = DSY_QSPI_MODE_INDIRECT_POLLING;
dsy_qspi_init(&hardware.qspi_handle);

// erase

dsy_qspi_erase(base, base + sizeof(flashConfigSave));

// write

dsy_qspi_write(base, sizeof(flashConfigSave), (uint8_t*)&flashConfigSave);

// de-init

dsy_qspi_deinit();

}

void UtilFlashLoad()
{

// init and set mode

hardware.qspi_handle.mode = DSY_QSPI_MODE_DSY_MEMORY_MAPPED;
dsy_qspi_init(&hardware.qspi_handle);

// Flash is memory mapped so no need to read

// copy data from opdLoadConfig struct to data

if (flashConfigLoad.configVersion == FLASH_CONFIG_VERSION)
{

  <copy data back to struxt>

}

// de-init

dsy_qspi_deinit();

}

Hey @StaffanMelin thanks. The fact that somebody had it working led me to persevere - found the problem.

QSPI.cpp is missing hw.Configure() before hw.Init() - so it had the default wrong flash device and was tying itself in knots.

@shensley what’s the etiquette here when we find small code issues - can we just tag you here or would you prefer an issue on the relevant github?

Cheers,
Jared

1 Like

Thanks for bringing this to my attention! I suspect the example was originally written for the Pod or Patch and later migrated to the Seed (since those don’t require the Configure() function.

We’ll get that fixed up ASAP. While I appreciate the tag here, I do prefer Github Issues especially when it’s clearly a bug or issue in the code as its a lot easier to keep track of, and it can alert others to the problem if they’re looking.

1 Like