Tool/software: Code Composer Studio
I used the On-Chip Flash Option under the Tools menu in Code Composer studio to set a password and lock my flash. I then call the code that I have pasted below in my app but my flash
remains locked. Can you please suggest what could be the problem?
#define STATUS_FAIL 0
#define STATUS_SUCCESS 1
Uint16 CsmUnlock()
{
volatile Uint16 temp;
// Load the key registers with the current password. The 0xFFFF's are dummy
// passwords. User should replace them with the correct password for the DSP.
asm(" EALLOW");
CsmRegs.KEY0 = 0x1111;
CsmRegs.KEY1 = 0x2222;
CsmRegs.KEY2 = 0x3333;
CsmRegs.KEY3 = 0x4444;
CsmRegs.KEY4 = 0x5555;
CsmRegs.KEY5 = 0x6666;
CsmRegs.KEY6 = 0x7777;
CsmRegs.KEY7 = 0x8888;
__asm(" EDIS");
// Perform a dummy read of the password locations
// if they match the key values, the CSM will unlock
temp = CsmPwl.PSWD0;
temp = CsmPwl.PSWD1;
temp = CsmPwl.PSWD2;
temp = CsmPwl.PSWD3;
temp = CsmPwl.PSWD4;
temp = CsmPwl.PSWD5;
temp = CsmPwl.PSWD6;
temp = CsmPwl.PSWD7;
// If the CSM unlocked, return succes, otherwise return
// failure.
if (CsmRegs.CSMSCR.bit.SECURE == 0)
return STATUS_SUCCESS;
else
return STATUS_FAIL;
}