Subject: TMS320F28069: Unlocking CMS does not work.
Hello team,
I tried to enter the Secure Mode, then to return from it back to Unsecure Mode. Entering the S.M. worked but
returning to U.M. failed, despite using the recommended procedure.
So, the device cannot be flashed by both debugger and our bootloader -- It seems lost.
The steps I carried out were:
I mapped a constant array Uint16 CsmPwl[8] that carries the password to Adr. 3f7ff8:
Declaration:
#pragma DATA_SECTION(CsmPwl,"CsmPwlFile");
const struct CSM_PWL CsmPwl = {0x434C, 0x4F53, 0x4544, 0x2034, 0x2052, 0x4F4D, 0x414E, 0x5321};
Using MAP file and debugger, I verified that the password array was in correct location, and order of elements was correct.
I verified that all key registers were 0xFFFF on program start.
Verified that the key variable CsmRegs was mapped to the right address.
On start of the debugger (before calling the function which does unsecuring), the device was unsecure
despite the mentioned password had been programmed to flash.
A call to function DeviceUnsecure( ) is done immediately at beginning of main() after the declarations. (listings next page).
-- I just stepped through the declarations and stopped before DeviceUnsecure was called.
At that point, I manually set CSMSCR to 0x8000.
The device switched to secure immediately, as could be seen from the debugger's display.
Then I stopped debugging and rebooted the device without debugger (power off/on).
I expected the device to be unsecure now, as DeviceUnsecure is called as first action in program flow. See code listings below.
I found that the device was still secure despite that call, so that now no more access is possible as mentioned above.
So, what could have happened or went wrong? Are there mistakes in the manual?
void main( void )
{
Uint16 u16_main_scratch = 0;
volatile eEEP_RET eepState;
int iwait;
DeviceUnsecure ( );
f32_gl_id_sollwert = 0.0;
LedState.all = OFF;
...
...
}
--------------------------------------------------
Listing of DeviceUnsecure ( ):
...
#define PASSWORD_LENGTH 8
...
void DeviceUnsecure ( void )
{
Uint16 i;
Uint16 *pCell;
volatile Uint16 tmp;
pCell = (Uint16*) &CsmPwl; // CsmPWL is global!
for ( i = 0; i < PASSWORD_LENGTH; i++ ) tmp = *pCell++;
EALLOW;
CsmRegs.KEY0 = 0x434C;
CsmRegs.KEY1 = 0x4F53;
CsmRegs.KEY2 = 0x4544;
CsmRegs.KEY3 = 0x2034;
CsmRegs.KEY4 = 0x2052;
CsmRegs.KEY5 = 0x4F4D;
CsmRegs.KEY6 = 0x414E;
CsmRegs.KEY7 = 0x5321;
EDIS;
}
Declaration/Initialization of global CsmPwl:
const struct CSM_PWL CsmPwl = {0x434C, 0x4F53, 0x4544, 0x2034, 0x2052, 0x4F4D, 0x414E, 0x5321};
Best Regards,
Goetz