cancel
Showing results for 
Search instead for 
Did you mean: 

Use STM32F4 flash for non-volatile data storage (eeprom)

syedhashmiraza
Associate II

hello i am using stm32f429i-disc1 microcontroller board in this how to generate flash code (eeprom)

 


Your other thread showed a major confusion between what is a "microcontroller", and what is a "board" - so edited for clarity.

30 REPLIES 30

This code is not build on stm32f429i-disc1 and iam using stm32cube ide software

What do you mean?

AndrewNeil_0-1731674288942.png

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

when i build this so many error are showing ?

syedhashmiraza
Associate II

(merged from duplicate thread)

 

hello iam using srm32f429i-disc1 microcontroller board and i want refrence code for emulated eeprom 

I think you have to use the STM32 HAL library. 

yes iam using HAL library

hello iam using srm32f429i-disc1 microcontroller board and i want refrence code for emulated eeprom 

this code is not build in stm32cubeide

syedhashmiraza_0-1731748623361.png

 

The EEPROM emulation itself is just the eeprom.c & eeprom.h files.

The rest is just a "test harness" to demonstrate that.

So you should be able to:

  1. Create a new Project in CubeIDE - make sure that builds as-is.
  2. Copy the  eeprom.c & eeprom.h files into your project.
  3. Copy the test code as text from main.c in the EEPROM GitHub, and paste it into the main.c in your own project.
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
syedhashmiraza
Associate II

Hello,

I want to read and write string in eeprom  this is my code but in this code string is not storing in eeprom

 

#include "main.h" #include <stdio.h> /** @addtogroup EEPROM_Emulation * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Virtual address defined by the user: 0xFFFF value is prohibited */ uint16_t VirtAddVarTab[NB_OF_VAR] = {0x5555, 0x6666, 0x7777}; uint16_t VarDataTab[NB_OF_VAR] = {0, 0, 0}; uint16_t VarValue,VarDataTmp = 0; /* Private function prototypes -----------------------------------------------*/ static void SystemClock_Config(void); static void Error_Handler(void); /* Private functions ---------------------------------------------------------*/ /** * @brief Main program. * None * @retval None */ //char writeString[] = "Hello Hashmi"; char readString[64]={0}; int main(void) { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Unlock the Flash Program Erase controller */ HAL_FLASH_Unlock(); /* Configure LED3 */ BSP_LED_Init(LED3); /* EEPROM Init */ if( EE_Init() != EE_OK) { Error_Handler(); } if((EE_ReadVariable(VirtAddVarTab[0], &readString[0])) != HAL_OK) { Error_Handler(); } while(1) { char writeString[] = "Hello"; for (int i = 0; i < sizeof(writeString); i++) { if (EE_WriteVariable(VirtAddVarTab[0] + i, (uint16_t*)&writeString[i]) != HAL_OK) { Error_Handler(); } } } }
View more