This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48L952 EEPROM can't write data

Hi Sir:

I can't write data to EEPROM( Flash at bank7) ,

I write 1 Byte to address:0xf0200000(bank7 sector0)

result : total 60 bytes set to 0x00 , refresh , and then return to 0xff

this program code at below:


void _EEPROM_Program_1Byte(void)
{
Fapi_StatusType oReturnCheck = Fapi_Status_Success;
FwpWriteByteAccessorType * oFwpWriteByteAccessor = FWPWRITE_BYTE_ACCESSOR_ADDRESS;
FwpWriteByteAccessorType * oFwpWriteEccByteAccessor = FWPWRITE_ECC_BYTE_ACCESSOR_ADDRESS;
FwpWriteDWordAccessorType * oFwpWriteDWordAccessor = FWPWRITE_DWORD_ACCESSOR_ADDRESS;

oReturnCheck = Fapi_initializeFlashBanks(220); /* Example code is assuming operating

frequency of 220 MHz */    /* The return value= 0x08 of this function call ,so no check oReturnCheck

temporarily at below */

// if((oReturnCheck == Fapi_Status_Success) &&

// (FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY != Fapi_Status_FsmBusy))


   if((FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY != Fapi_Status_FsmBusy))
  {
   oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank7);

   oReturnCheck = Fapi_enableEepromBankSectors(0x002,0x0); /*erase sector , 0x1 :settor 0 , 0x2:sector1 ,      ox4:sector2 , 0x8:sector3*/


   FLASH_CONTROL_REGISTER->Fbprot.u32Register = 1U; /* Disable Level 1 Protection */
/* Enable all sectors of current bank for erase and program. For EEPROM banks with more
than 16 sectors, this must be 0xFFFF */
   FLASH_CONTROL_REGISTER->Fbse.u32Register = 0xFFFF;
   FLASH_CONTROL_REGISTER->Fbprot.u32Register = 0U; /* Enable Level 1 Protection */
/*Unlock FSM registers for writing */
   FLASH_CONTROL_REGISTER->FsmWrEna.u32Register = 0x5U;
/* Set command to "Clear the Status Register" */
   FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ClearStatus;

/* Execute the Clear Status command */

   FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* Write address to FADDR register */
   FLASH_CONTROL_REGISTER->Faddr.u32Register = 0xf0200000U;  //bank7 sector0

   oFwpWriteByteAccessor[2] = 0xA5;

/* Set command to "Program" */
   FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ProgramData;
/* Execute the Program command */
   FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* re-lock FSM registers to prevent writing */
   FLASH_CONTROL_REGISTER->FsmWrEna.u32Register = 0x2U;

////
/* Wait for FSM to finish */
   while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
/* Check the FSM Status to see if there were no errors */
     if (FLASH_CONTROL_REGISTER->FmStat.u32Register != 0)
     {
       /* Put Error handling code here */

     }
   }


}

 

  • The function Fapi_initializeFlashBanks() failed so there is no point in looking at the rest until that is fixed. Check the values of RWAIT and EWAIT.
    Some of the prototype xRM48 devices were configured so they need RWAIT and EWAIT set to 4 for programming above 200MHz. These devices can be identified by looking at memory location 0xF008017C. A value of 0x0200F01C is the correct value, 0x0200F019 is the older incorrect value requiring the extra wait-state for programming or erasing.
  • Hi Bob:I check 0xF008017C = 0x0200F01C, yes , it is correct
    I add code before Fapi_initializeFlashBanks(220), set EWAIT=4, as below
    REGISTER(0xfff87288) = 0x00000005; /* enable writes to EWAIT register */
    REGISTER(0xfff872B8) = 0x00040002; /* EWAIT=4 */
    REGISTER(0xfff87288) = 0x00000002; /* disable writes to EWAIT register */
    It is same condition:
    result : total 60 bytes set to 0x00 , refresh , and then return to 0xff
    Best Regards,Ken Lin
  • What is the value of RWAIT?