cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4-Discovery EEPROM emulation demo does not work

hansuk
Associate
Posted on December 07, 2016 at 03:21

I have STM32F4-Discovery board. (MB997B with Discovery-MO expansion board)

From STM32Cube package, I ran several examples, applications and demo successfully. But EEPROM_Emulation application does not work well.

STM32Cube_FW_F4_V1.13.0\Projects\STM32F4-Discovery\Applications\EEPROM\EEPROM_Emulation

When I start program, LD4 is blinking, indicating error is occurred. I tracked step-by-step, so error occurred here.

--

EE_Init(void)

switch (PageStatus0)

/* Page0 valid, Page1 receive */

              /* Transfer the variable to the Page1 */

              EepromStatus = EE_VerifyPageFullWriteVariable(VirtAddVarTab[VarIdx], DataVar);

              /* If program operation was failed, a Flash error code is returned */

              if (EepromStatus != HAL_OK)

              {

                return EepromStatus;

              }

main()

  /* EEPROM Init */

  if( EE_Init() != EE_OK)

  {

    Error_Handler();

  }

--

I tried this with EWARM 7.70 and SW4STM32 and the result are same.

I don't understand why it does not work. I changed nothing in the program. There seems no hardware configuration.

3 REPLIES 3
Nesrine M_O
Lead II
Posted on December 07, 2016 at 10:30

Hi

Kim.Hansuk

‌,

I tested the EEMPROM application on STM32F4-Discovery (STM32F407xx devices) using MDK-ARM V5.17 and IAR embedded workbench 7.70, and it works as expected.

Please before using the application, ensure that dedicated sectors for EEPROM (FLASH_SECTOR_2 and FLASH_SECTOR_3) are erased to avoid a match with a valid page OPCODE.

STM32Cube_FW_F4_V1.0\Projects\STM32F4-Discovery\Applications\EEPROM\EEPROM_Emulation

-Nesrine-

Ifmy suggestanswers your question, please mark it as correct.

cj blades
Associate II
Posted on December 13, 2016 at 19:34

https://developer.mbed.org/users/mega64/code/00_eeprom_emulation_f401/docs/e91328f723ab/eeprom_8cpp_source.html

Try the eeprom code at this link.

It has a fix in EE_VerifyPageFullyErased ()

The version of code in the distribution only erases PAGE0

The code at this link has the same exact version in the header, as the one I had I the distribution (STM32Cube_FW_F4_V1.13.0)  that is wrong

  ******************************************************************************

  * @file    EEPROM/EEPROM_Emulation/src/eeprom.c

  * @author  MCD Application Team

  * @version V1.0.1

  * @date    29-January-2016

  * @brief   This file provides all the EEPROM emulation firmware functions.

Same problem exists in STM (STM32Cube_FW_F4_V1.14.0) 

 since only the header of the file changed.

Posted on December 13, 2016 at 20:14

 In eeprom_init, the  code is setup to erase both pages if they are both marked valid. But it doesn't work. It only erases page0 not page1

/* Erase both Page0 and Page1 and set Page0 as valid page */

        FlashStatus = EE_Format();