Hello fellow engineers,
I'd like to ask if some of you ever experienced problems in writing fuses on i.MX RT processors.
In production, we write the BT_FUSE_SEL to allow our device to start from QSPI.
We have had a small but significant number of cases where the writing operation seems to succeed, but the change is not permanent, so once we cycle power the board, the firmware does not start.
Please note that normally the operation succeeds!
Someone else experienced this problem? Suggestions?
Thanks. Please find below the code we use.
Giuseppe
if (!(SRC->SBMR2 & SRC_SBMR2_BT_FUSE_SEL_MASK)) // ( check the bit if new device or not )
{
//ipg_clk=132MHz, Calculation described at Chapter 42.3.3 OTP Read/Write Timing Parameters
int timing = OCOTP_TIMING_STROBE_PROG(1325) | OCOTP_TIMING_RELAX(2) | OCOTP_TIMING_STROBE_READ(11) |OCOTP_TIMING_WAIT(24);
OCOTP->TIMING = timing;
//Check that HW_OCOTP_CTRL[BUSY] and HW_OCOTP_CTRL[ERROR]are clear
while ((OCOTP->CTRL & (1<<OCOTP_CTRL_BUSY_SHIFT)) || (OCOTP->CTRL & (1<<OCOTP_CTRL_ERROR_SHIFT)))
;
// Page 6 bank 0 = 0x460
uint32_t fuses = OCOTP->CTRL;
fuses &= ~(OCOTP_CTRL_ADDR_MASK | OCOTP_CTRL_WR_UNLOCK_MASK);
fuses |= OCOTP_CTRL_ADDR(6) | OCOTP_CTRL_WR_UNLOCK(0x3E77);
OCOTP->CTRL = fuses;
fuses = OCOTP->DATA;
fuses |= (long)((1<<4));//burn BT_FUSE_SEL (1<<4)
OCOTP->DATA = fuses;
}