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.

28377s OTP flash中的bootctrl配置问题

28377s在仿真时,通过On-Chip Flash,将Z1-BOOTCTRL改为0xFFFFFFFE,点击Program OTPBOOTCTRL,写入成功。想要再次修改Z1-BOOTCTRL为0xFFFFFF5A时却发现不能成功。

已知OTP flash中每一位从1写为0只能写一次,我将Z1-BOOTCTRL中的最后一位写0,改为0xFFFFFFFE后,想要再将其他位由1写为0却无法成功,请问这是什么原因?

  • OTP只能被编程一次,并且不能被擦除。如果要二次编写的话需要用到flash API函数,并且如你所说,它的每个位只能由“1”改为“0”不可逆。
  • 你好,按照你说的用flash API函数。我用ti中的例程在Z1-BOOTCTRL寄存器(0x7801E)写入0xFFFFFF5A,仍然是不能成功。

    以下是程序:

    Flash_Addr = 0x0007801E,sbuf = 0xFFFFFF5A,length = 2.

    void Flash_program(USIGN32 Flash_Addr,USIGN16 *sbuf,USIGN16 length)

    {

    USIGN32 *Buffer32 = (USIGN32 *)sbuf;

    USIGN32 u32Index = 0;

    Fapi_StatusType oReturnCheck;

    volatile Fapi_FlashStatusType oFlashStatus;

    Fapi_FlashStatusWordType oFlashStatusWord;

    if(Flash_Addr < 0xC0000){

    PUMPREQUEST = 0x5A5A0002;// Give pump ownership to FMC0

    // This function is required to initialize the Flash API based on System

    // frequency before any other Flash API operation can be performed

    // Note that the FMC0 register base address is passed as the parameter

    oReturnCheck = Fapi_initializeAPI(F021_CPU0_W0_BASE_ADDRESS, 150);

    if(oReturnCheck != Fapi_Status_Success)

    {

    SciaRegs.SCITXBUF.bit.TXDT = 0xA0;//失败时发送0xA0

    while(SciaRegs.SCICTL2.bit.TXEMPTY == 0){}

    for(;;);

    }

    // Fapi_setActiveFlashBank function sets the Flash bank0 and FMC0 for

    // further Flash operations to be performed on the bank0.

    // Note that the parameter passed is Fapi_FlashBank0 since FMC0 register

    // base address is passed to Fapi_initializeAPI()

    oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);

    if(oReturnCheck != Fapi_Status_Success)

    {

    SciaRegs.SCITXBUF.bit.TXDT = 0xA0;//失败时发送0xA0

    while(SciaRegs.SCICTL2.bit.TXEMPTY == 0){}

    for(;;);

    }

    // Disable ECC so that error is not generated when reading Flash contents

    // without ECC

    Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;


    u32Index = Flash_Addr;


    oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)u32Index,sbuf,

    length,0,0,

    Fapi_DataOnly);


    while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);


    if(oReturnCheck != Fapi_Status_Success)

    {

    SciaRegs.SCITXBUF.bit.TXDT = 0xA0;//失败时发送0xA0

    while(SciaRegs.SCICTL2.bit.TXEMPTY == 0){}

    for(;;);

    }


    // Read FMSTAT register contents to know the status of FSM

    // after program command for any debug

    oFlashStatus = Fapi_getFsmStatus();


    // Verify the values programmed. The Program step itself does a verify

    // as it goes. This verify is a 2nd verification that can be done.

    oReturnCheck = Fapi_doVerify((uint32 *)u32Index,length/2,Buffer32,

    &oFlashStatusWord);


    if(oReturnCheck != Fapi_Status_Success)

    {

    SciaRegs.SCITXBUF.bit.TXDT = 0xA0;//失败时发送0xA0

    while(SciaRegs.SCICTL2.bit.TXEMPTY == 0){}

    for(;;);

    }

    }

    }

    程序执行Fapi_issueProgrammingCommand时,返回Fapi_Status_Success,但其实目标位置并没有写入正确的0xFFFFFF5A,仍为0xFFFFFFFE.

    在执行Fapi_doVerify时,返回Fapi_Error_Fail.

    不知道你说的flash API函数是不是我调用的这个函数。麻烦再解答一下,感谢!