This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EEPROM EMULATION on STR71x family CPU

I am having a problem trying to use internal flash (bank1)as EEPROM of STR71x family microprocessor. Using a HITEX eval board (purchased from Keil) and I copied code directly from the sample files came with the compiler --- the result was, system
hung immediately when I ran it. Could the ARM expert(s) this forum kindly take a look
at the code below and then please tell
me what I did wrong here?

Thanks in advance,

JIMMY

int main(void)
{
 u32 Read_Data;

     /*  Initialize the FLASH */
  FLASH_Init () ;
     /*  Disable temporarily the FLASH   protection on Bank 1 sector 0 */
  FLASH_WritePrConfig (FLASH_B1F0,DISABLE) ;  //<<< SYSTEM HANG !! begins here

  /*  Erase Bank 1 sector 0 */
  FLASH_SectorErase (FLASH_B1F0) ;

  /*  Write  0x12345678 to Bank 1 sector 0 */
  FLASH_WordWrite (0x000C0000,0x12345678) ;

  /* Read back the written data at address 0x400C0000*/
   Read_Data = FLASH_WordRead(0x000C0000);

  /* Display the read data on the debugger output window. You can use also
     the debugger memory window to verify the good content of the flash at
     0x400C0000 address and see the value "0x12345678"*/
   printf(" The data written at address 0x400C0000 is %x\n",Read_Data);
   printf("\n");

  /* Warning!! : The write protection can be enabled ONLY on a permanent way */

  /*  Enable the FLASH protection on Bank 1 sector 0 */
  /*  FLASH_WritePrConfig (FLASH_B1F0,ENABLE) ; */

  while(1);

}

0