cancel
Showing results for 
Search instead for 
Did you mean: 

[TouchGFX] How to use qspi flash memory in already setted touchgfx project

ENaml.1
Associate II

Hello, I'm using stm32h750b-dk and I created an user interface with TouchGFX. This UI gets some user inputs and evaluting some results with that inputs. Here is my question is how can I save this user inputs and some config variables to qspi flash memory ?, and is the auto-generated touchgfx stm32 project already creates the qspi interface and driver?

This variables must be non-volatile if there is another method to do that I can go with that, I'm very open the suggestions.

Thanks

1 ACCEPTED SOLUTION
5 REPLIES 5
SPozz.1
Associate III

Hello,

you should find somewhere in the project source code that the QSPI Flash is configured in memory mapped mode. In this way Touchgfx can read the image data taking them from an address/pointer instead of interacting with peripheral registers. It is not complex to reserve a few pages at the end of the QSPI Flash space for saving data, but to do so you must revert to block mode by disabling memory mapped mode, write to flash and then re-enable memory mapped mode before returning to the loop where Touchgfx is polled.

For more details about memory mapped/block mode:

https://support.touchgfx.com/4.21/docs/development/board-bring-up/how-to/06-flash-external-addressable

https://support.touchgfx.com/4.21/docs/development/board-bring-up/how-to/07-flash-external-nonaddressable

Another method is to use the MCU's internal flash, but you should be sure not to wearout the pages you reserved for this purpose (see datasheet about flash endurance). The limited number of erase/write cycles can be overcome with eeprom emulation technique, see AN4894.

ENaml.1
Associate II

Hello,

Thank you for your clear explanation. As you said, I removed the memory mapped mode part for qspi, but while doing this, I saw that there are 2 flash instances for this card. I wonder if this part is completely separate flash from touchgfx?

0693W00000aICjXQAW.pngActually my data is really small I just want to save 10 uint16_t variables, when user power off and power on the device, the numbers and choices must be saved.

0693W00000aICjcQAG.pngAnd for the eeprom emulation, there is no another sector in the flash.

Thank you again

SPozz.1
Associate III

Check the stm32h750b-dk board schematic, Page 11, you will see U2 and U1, each chip over it's own bus.

So, the QSPI is in dual bank mode. The data are fetched 8bits at a time to double the speed. You shoud disable dual flash mode and than write/read using only one chip.

ENaml.1
Associate II

Can you provide me some example or at least kinda psuedo code something?, I'm really far from the qspi theory.

Thank you very much for your explanations, I learned a lot today