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);

}

Parents
  • i wrote the following codes on keil simulation software for LPC2102.
    i added the startup file and my source file on debugging gave no error but the registers containts were not as accepted.
    the source code was:
    AREA programe,CODE,READONLY
    EXPORT main
    IMPORT |Lib$$Request$$armlib|,WEAK
    IMPORT _main
    main
    LDR R1,Value
    MVN R1,R1
    STR R1,Result
    SWI 0x11
    Value DCD 0xC123
    Result DCD 0
    END
    and when i debugged using single step , the process is getting stuck up at some point in stareup's disassambled codes...somewhere
    0x00000178 to 0x00000184 address. The arrow mark do not proceed further.
    please help me out of this problem.

Reply
  • i wrote the following codes on keil simulation software for LPC2102.
    i added the startup file and my source file on debugging gave no error but the registers containts were not as accepted.
    the source code was:
    AREA programe,CODE,READONLY
    EXPORT main
    IMPORT |Lib$$Request$$armlib|,WEAK
    IMPORT _main
    main
    LDR R1,Value
    MVN R1,R1
    STR R1,Result
    SWI 0x11
    Value DCD 0xC123
    Result DCD 0
    END
    and when i debugged using single step , the process is getting stuck up at some point in stareup's disassambled codes...somewhere
    0x00000178 to 0x00000184 address. The arrow mark do not proceed further.
    please help me out of this problem.

Children
No data