Flash_ErasePage with STM32F2xx Question

#1

Hi @ll,

I am moving the HTTPS App from the W7200 to the W5500 with a STM32F2xx MCU.
And I am having a question regarding the code added by Gang 2011-9-27.

while([color=#FF0000]FLASH_ErasePage/color!= FLASH_COMPLETE);

As for the STM32F2xx MCU there is no FLASH_ErasePage. There is only a “FLASH_EraseSector” which needs a VoltageRange_?
What is the correct VoltageRange needed for that?

/* Program the network parameters received into STM32F1xx Flash */
//Added by Gang 2011-9-27
        FLASH_Unlock(); 
        
//while(FLASH_ErasePage(FlashDestination)!= FLASH_COMPLETE); //   FLASH_ErasePage for STM32F10x

 while(FLASH_EraseSector(FlashDestination, VoltageRange_1)!= FLASH_COMPLETE); // VoltageRange needed?
        
        while(FLASH_ProgramWord(FlashDestination, ChipID)!= FLASH_COMPLETE);
        if (*(u32*)FlashDestination != ChipID)
        {
          Sprintf(buffer, "%s","\r\n ChipID Flash writing error!!!");
        }
#2

Hi,
Refer to st document.
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00023896.pdf

12.2.7.3 FLASH_EraseSector
Function Name FLASH_Status FLASH_EraseSector ( uint32_t FLASH_Sector,
uint8_t VoltageRange)
Function Description Erases a specified FLASH Sector.
Parameters  FLASH_Sector : The Sector number to be erased. This
parameter can be a value between FLASH_Sector_0 and
FLASH_Sector_11
 VoltageRange : The device voltage range which defines the
erase parallelism. This parameter can be one of the following
values:
 VoltageRange_1 : when the device voltage range is
1.8V to 2.1V, the operation will be done by byte (8-bit)
 VoltageRange_2 : when the device voltage range is
2.1V to 2.7V, the operation will be done by half word (16-
bit)
 VoltageRange_3 : when the device voltage range is
2.7V to 3.6V, the operation will be done by word (32-bit)
 VoltageRange_4 : when the device voltage range is
2.7V to 3.6V + External Vpp, the operation will be done
by double word (64-bit)
Return values  FLASH Status: The returned value can be:
FLASH_BUSY, FLASH_ERROR_PROGRAM,
FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or
FLASH_COMPLETE.
Notes  None.

You can use VotageRange_3 ~ 1 except VotageRange_4.

Thank you.

#3

Hi,

thx for the reply