We are using STR912FA444X6, with Keil MDK, OTP data is not read correctly after boot loader transfer the control to main application. OTP data is correct if board directly start with main application.
The code to read the OTP data is given below
u32 FMI_ReadOTPData(u8 FMI_OTPAddress) { u32 OTP_Data = 0x0; /* write a read OTP sector command */ *(vu16 *)(FMI_BANK_1) = 0x98;
/* Read the correspondent data */ OTP_Data = (*(vu32*)(FMI_BANK_1 + FMI_OTPAddress));
/* Write a read array command */ *(vu16 *)(FMI_BANK_1) = 0xFF;
return OTP_Data; }
void ReadMAC_OTP(void) { //Read data from OTP u8 i ,j; j = FMI_OTP_WORD_0;
for(i=0;i<8;i++){ OTP.Data[i] = FMI_ReadOTPData(j); j = j + 4; }
}
Please suggest the solution. Thanks in advance.