cancel
Showing results for 
Search instead for 
Did you mean: 

Saving data in QSPI Flash | STM32F469i-DISCO

MFOWE
Associate II

Hello,

I'm a total beginner and I'm looking to store some user data in the QSPI Flash,, but I don't really know how to proceed can you help me ?

First, I changed the flash memory size in the .ld file from 16M to 12M so that TouchGFX won't overwrite my data. But from now, I don't know what to do...

How can I write and read to this 'allocated' space ?

Thanks

15 REPLIES 15

I'm not sure it will help but I did a video on how to include the QSPI into cubeIDE while running TouchGFX: https://www.youtube.com/watch?v=237lPdMsDZs

also, you might want to have a look at how the framebuffer is created. it's located at the start of the SDRAM memory space which should be available in the same way as the QSPI memory:

static uint32_t frameBuf0 = (uint32_t)(0xc0000000);

then you have the address of the memory and you could use that as a pointer to your data.. I hope :)

I'm not using TouchGFX

If in QPI mode some of the commands sent to the memory chip change, there is also 3 or 4 byte addressing modes. It may be possible to write while in memory-mapped mode (via commands, not the memory mapping), but the BSP doesn't seem to be sufficiently context sensitive.

The memory doesn't understand the mapping on the CPU side, the commands expect zero based addressing of their internal array.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi @MFOWE​,

QSPI is not in memory mapped mode by default unless you use our application template. CubeMX doesn't concern itself with BSP, so additional user code is required (Specified in the CubeIDE video i made).

/Martin

Hello @Martin KJELDSEN​ ,

The thing is that I am the Touch GFX application template. So most of the programming I've done yet was using your GUI and msv. But now, I'm stuck and don't understand how can I have a variable from my view / model to get programmed to the QSPI.

L4Y
Associate II

Hi, @MFOWE​ ,

Since you are using the TouchGFX application Template, the QSPI flash is initialized in memory-mapped mode, so in your model class, you have to do the following to save data to QSPI flash.

  1. Deinit QSPI interface. I'm not sure if it has BSP interface to disable memory-mapped mode, but in my experience, it doesn't have.
  2. Init QSPI interface. Now you are in indirect mode.
  3. Call BSP interfaces to write data to flash, like BSP_QSPI_erase(); BSP_QSPI_write().
  4. After you saving data, you have to enable memory-mapped mode again to ensure TouchGFX works.

But actually I don't recommend to save date in QSPI flash when using TouchGFX. It should work fine when you write to the flash in TouchGFX task. But when you write data to the flash in other tasks, you have to do some tricky to avoid system crash.

Best Regards.

I did not believe that here on ST forum is anyone who really helps. I would like to thank you for this, hope more people will answer like you!