L'émulation EEPROM sur stm32 à l'aide de HAL pilotes

Je suis en essayant d'imiter l'EEPROM sur stm32f0. Il y a un note d'application fourni par la STM.

Dans l'échantillon main.c,

int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f0xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f0xx.c file
     */ 
   /* Unlock the Flash Program Erase controller */
  FLASH_Unlock();

  /* EEPROM Init */
  EE_Init();

/* --- Store successively many values of the three variables in the EEPROM ---*/
  /* Store 0x1000 values of Variable1 in EEPROM */
  for (VarValue = 1; VarValue <= 0x64; VarValue++)
  {
    EE_WriteVariable(VirtAddVarTab[0], VarValue);
  }

  /* read the last stored variables data*/
  EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]);


  /* Store 0x2000 values of Variable2 in EEPROM */
  for (VarValue = 1; VarValue <= 0xC8; VarValue++)
  {
    EE_WriteVariable(VirtAddVarTab[1], VarValue);
  }

  /* read the last stored variables data*/
  EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]);
  EE_ReadVariable(VirtAddVarTab[1], &VarDataTab[1]);


  /* Store 0x3000 values of Variable3 in EEPROM */
  for (VarValue = 1; VarValue <= 0x1C2; VarValue++)
  {
    EE_WriteVariable(VirtAddVarTab[2], VarValue);
  }

  /* read the last stored variables data*/
  EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]);
  EE_ReadVariable(VirtAddVarTab[1], &VarDataTab[1]);
  EE_ReadVariable(VirtAddVarTab[2], &VarDataTab[2]);

  while (1);
}

Flash_Unlock() est une fonction utilisée dans STM standard périphérique de la bibliothèque. Cependant, je suis en utilisant CubeMX que l'auto-génère un code qui utilise HAL pilotes. Est Flash_Unlock() nécessaire d'être appelée avant que l'on puisse utiliser le EEPROM_emulation Api? Si oui, quel est le HAL équivalent pour appeler Flash_Unlock()? Aucune configuration spéciale réglages à faire sur CubeMX à l'utilisation de l'EEPROM de l'émulation?

Vous êtes à la recherche pour HAL_FLASH_Unlock(), mais STM32Cube fournit des exemples pour certaines planches, par exemple STM32Cube_FW_F4_V1.21.0/Projects/STM32F4-Discovery/Applications/EEPROM/EEPROM_Emulation

OriginalL'auteur | 2016-05-23