cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 FLASH problem

one V
Associate III
Posted on June 02, 2018 at 09:37

X:\STMicroelectronics\STM32Cube\Repository\STM32Cube_FW_H7_V1.2.0\Projects\STM32H743I_EVAL\Applications\IAP\IAP_Main

0690X0000060L4vQAE.png

Isn't function HAL_FLASH_Lock() supposed to be in position 2?

8 REPLIES 8
Nesrine M_O
Lead II
Posted on June 04, 2018 at 11:05

Hi

v.v.010

,

I will check this problem with our development team & come back to you.Sorry for the inconvenience may bring.

-Nesrine-

Posted on June 05, 2018 at 05:16

Thank you very much for your reply.

In addition, by the way, I use the example of IAP provided in STM32Cube_FW_H7_V1.2.0\Projects\STM32H743I_EVAL\Applications\IAP\IAP_Main\, but the loaded APP program can not run. The APP code I have set the interrupt vector table and jump address.

GreenGuy
Lead

Thank you for pointing this out. I was wondering why after the erase function call, the memory was not erased. I move the Lock function down to:

and now the flash erase works.

GreenGuy
Lead

Sorry, my screen shot did not work.

GreenGuy
Lead

AHHHH!

uint16_t FLASH_If_GetWriteProtectionStatus(void)

{

 uint32_t ProtectedSECTOR = 0x0;

 FLASH_OBProgramInitTypeDef OptionsBytesStruct;

 /* Unlock the Flash to enable the flash control register access *************/

 HAL_FLASH_Unlock();

// /* Lock the Flash to disable the flash control register access (recommended

//    to protect the FLASH memory against possible unwanted operation) *********/

// HAL_FLASH_Lock();

 if (APPLICATION_ADDRESS < ADDR_FLASH_SECTOR_0_BANK2)

 {

   /* Select Bank1 */

   OptionsBytesStruct.Banks = FLASH_BANK_1;

   /* Check if there are write protected sectors inside the user flash area ****/

   HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);

   /* Get pages already write protected ****************************************/

   ProtectedSECTOR = OptionsBytesStruct.WRPSector & FLASH_SECTOR_TO_BE_PROTECTED;

 }

 /* Select Bank2*/

 OptionsBytesStruct.Banks = FLASH_BANK_2;

 /* Check if there are write protected sectors inside the user flash area ****/

 HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);

 /* Get pages already write protected ****************************************/

 ProtectedSECTOR |= OptionsBytesStruct.WRPSector & FLASH_SECTOR_TO_BE_PROTECTED;

 /* Lock the Flash to disable the flash control register access (recommended

    to protect the FLASH memory against possible unwanted operation) *********/

 HAL_FLASH_Lock();

 /* Check if desired pages are already write protected ***********************/

 if(ProtectedSECTOR != 0)

 {

   /* Some sectors inside the user flash area are write protected */

   return FLASHIF_PROTECTION_WRPENABLED;

 }

 else

 {

   /* No write protected sectors inside the user flash area */

   return FLASHIF_PROTECTION_NONE;

 }

}

Someday I figure out how you guys are doing that.

GreenGuy
Lead

So this new website is not very intuitive or I am not able to see what I paste AFTER I click on Answer.

GreenGuy
Lead

uint16_t FLASH_If_GetWriteProtectionStatus(void)

{

 uint32_t ProtectedSECTOR = 0x0;

 FLASH_OBProgramInitTypeDef OptionsBytesStruct;

 /* Unlock the Flash to enable the flash control register access *************/

 HAL_FLASH_Unlock();

// /* Lock the Flash to disable the flash control register access (recommended

//    to protect the FLASH memory against possible unwanted operation) *********/

// HAL_FLASH_Lock();

 if (APPLICATION_ADDRESS < ADDR_FLASH_SECTOR_0_BANK2)

 {

   /* Select Bank1 */

   OptionsBytesStruct.Banks = FLASH_BANK_1;

   /* Check if there are write protected sectors inside the user flash area ****/

   HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);

   /* Get pages already write protected ****************************************/

   ProtectedSECTOR = OptionsBytesStruct.WRPSector & FLASH_SECTOR_TO_BE_PROTECTED;

 }

 /* Select Bank2*/

 OptionsBytesStruct.Banks = FLASH_BANK_2;

 /* Check if there are write protected sectors inside the user flash area ****/

 HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);

 /* Get pages already write protected ****************************************/

 ProtectedSECTOR |= OptionsBytesStruct.WRPSector & FLASH_SECTOR_TO_BE_PROTECTED;

 /* Lock the Flash to disable the flash control register access (recommended

    to protect the FLASH memory against possible unwanted operation) *********/

 HAL_FLASH_Lock();

 /* Check if desired pages are already write protected ***********************/

 if(ProtectedSECTOR != 0)

 {

   /* Some sectors inside the user flash area are write protected */

   return FLASHIF_PROTECTION_WRPENABLED;

 }

 else

 {

   /* No write protected sectors inside the user flash area */

   return FLASHIF_PROTECTION_NONE;

 }

}

You can also Edit and place in code blocks </>

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..