2025-10-28 12:45 AM
Hi,
I'm developing a SW project in a WINSTAR display (MCU STM32F750) and using the STM SW (TouchGFX Designer, STM32CubeIDE and STM32CubeProgrammer).
Until now, I design different screens and some parameters are saved and managed by means of the Model.cpp & Model.hpp.
But now I need to save some values in the non-volatile memory because I need the screen starts with specific values stored.
What I need to configure and add in the code (and where) to enable the writing and reading in non-volatile memory?
Thanks in advance for your time :)
Josep
2025-10-28 2:43 AM
Hello Josep,
Do you have any other non-volatile memory than the internal flash available on your board?
I would handle this in the model just like the rest of your data.
2025-10-28 3:14 AM
Hi mathiasmarkussen,
I don't have any other non-volatile memory.
How I can manage that non-volatile values in the model?
As I know, the model save values while the screen is switched on. How I can save a specific value and get that value in the next screen wake-up?
2025-10-28 3:44 AM
Are you certain there is no external flash on your board? There would not be a lot of space for image assets in internal flash on that MCU. Can you link to the specific winstar product you're using?
As for storing the data in the model, you would save the data to non-volatile memory every time it changes. For retrieving the data, you can either initialize it to something unrealistic (0xFFFF for example), and retrieve the data from the non-volatile memory if it has that value or just retrieve it from non-volatile memory every time.
2025-10-28 7:29 AM
Hi mathiasmarkussen,
I attached the link to the winstar product: https://www.winstar.com.tw/products/smart-display/rs485_display/wl0f00043000wgdaasa00.html
According the datasheet, I check there has a 16Mb of flash memory. I understand there is where all (code, pictures, fonts) are saved, is it?
According your comments, the storing data in the model, every value that I save to the model is saved in a non-volatile memory? If it is true, how I retrieve the value when the screen is switched on? Currently, I initialize each value in the specific screen *.cpp. For example, the value Tipus is used in differents screens and it is initiazes in screen named Principal as:
PrincipalView::PrincipalView()
: Tipus(0);
{
}
After that, I save a number according the machine type and I should retrieve its value when the screen is switched on again. Now, all the values are "0" after the screen is switched on.
2025-10-30 9:15 AM
What I mean is that you should initialize the values in model.cpp instead. On initialisation, you can then add some custom code to handle reading them from non-volatile memory, as well as updating them as needed.
The 16 mb flash is external flash in addition to the internal flash in the MCU. In the PDF on the product page you can see that it communicates with the MCU via SPI.
One option to get some non-volatile memory is to reduce the size of the external flash in you linker script and then using the unlinked area for your own data. There is probably a driver included with your project that can erase pages and write data. Be aware that flash can only be written to if it has been erased beforehand, so you will need to store your data on different pages or write it all back when you erase a page.
Another option is to use the internal flash. A google search for something like "STM32 eeprom emulation" turns up quite a few results, including a package for CubeMX provided by ST, but I have not tried any of those myself.