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.

TMS320F28335: CsmUnlock running from unsecured RAM...

Part Number: TMS320F28335

Hi,

I'm sure this is a simple question to answer but I'm struggling to find a definitive answer...

I have a piece of Software that is loaded (and runs) from unsecured RAM.  Now, if I wanted to run the CsmUnlock() function to "unlock" the device, can I do this from unsecured RAM?  It's a little unclear to me at the moment whether I can Read (not Write or Run) from anywhere other than unsecured areas?  I've tried running CsmUnlock() from unsecured RAM and it will function but I always get the CSMSCR SECURE bit set to 0 (unlocked), even when I supply an incorrect password.  This suggests to me that CsmUnlock() isn't actually doing anything (probably as it's called from unsecured RAM).

Any pointers (no pun intended) to how the Secured-Unsecured system works?

Regards,

Mike.

  • Hi Mike,

    Now, if I wanted to run the CsmUnlock() function to "unlock" the device, can I do this from unsecured RAM?

    Yes, you can run the CsmUnlock() function from unsecure RAM.

    I've tried running CsmUnlock() from unsecured RAM and it will function but I always get the CSMSCR SECURE bit set to 0 (unlocked), even when I supply an incorrect password

    Do you ever get CSMSCR SECURE bit set to '1'? For example if you write '1' to FORCESEC bit in CSMSCR register and then read the SECURE bit what is the value? 

    Regards,

    Vivek Singh 

  • Hi,

    Ok, I checked the Memory Map, I'm actually running from RAML0 which IS secured - DOH.  Here is the Memory Map:

    I've tried two things to try and understand when unlocking occurs.  First of all I have changed the Key to see if I can "lock" the device:

    The Registers are updated correctly:

    The CSSCR SECURE bit stays at 0.

    Thinking that the XDS Debugger itself maybe performing the unlock when the RAML0 area is programmed I had a play around with the CSM Key in the Project Properties.  I changed this so it was incorrect:

    The device will still program and run from RAML0 with no errors.

    I guess I'm a little confused as to when the CSM becomes "unlocked" in order to write to secured RAM, or does it not have to be "unlocked" for RAM - only FLASH?  Or am I completely misunderstanding the datasheets?

    Basically I want to run some code from RAM that will perform a CSM Unlock.

    Thankyou,

    Mike.

  • Hi Mike,

    Are you programming anything in password location or leaving it to default value as 0xFFFF? If you are leaving it at default value 0xFFFF then device is always remains in un-secure state irrespective of CSM KEYx values.

    Regards,
    Vivek Singh
  • Hi Vivek,

    Ahh ok. The key is still all 0xFFFF's.

    The plan is to set a Key on the production board(s) but I wanted to test unlocking the device from RAM as I have a custom bootloader I have written than is downloaded to RAM via the SCI-Boot, this is then used (via the Flash API) to re-write the Ops code to Flash. Obviously I need to unlock the device in order to write to Flash...

    My thinking was that I could test the unlocking from RAM using a Dev Board I have here. From what you are saying, I would need to reset the CSM key to something else, all 0x1234 for example, and then test the unlocking/locking from RAM with that?

    Thankyou,
    Mike.
  • Hi Mike,

    From what you are saying, I would need to reset the CSM key to something else, all 0x1234 for example, and then test the unlocking/locking from RAM with that?

    That is correct and device can be unlocked by running unlock function from unsecure region.

    Regards,

    Vivek Singh

  • Vivek,

    Thankyou for your help. I will test this out straight away.

    Regards,
    Mike.