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.

How to set the Code Security Module (CSM) password for production code for TMS320F28069 Piccolo ?

Other Parts Discussed in Thread: TMS320F28069

For limited production and testing, I've been setting the CSM password through Code Composer.

For production, how is the CSM password set ?


const pointers in C?

Thanks.

  • Hi,

    If I understood you question correctly... According to me once the final build is done and released to production the CSM is already programmed in it and the same can be used multiple times. In short, CSM would/should be set in R&D itself and not production.

    Regards,
    Gautam
  • But how is the CSM programmed for production? Is it assigned values in the code? If so, what is the syntax? Or something else?
  • You can program the passwords in CCS once the code is developed. In your project look for DSP2806x_CSMPasswords.asm or something similar.

    You can find something like this once you open it:

    You enter your codes in PWLx locations.

    Regards,

    Gautam

  • Make sure you also have the appropriate linker command file which maps "section .cmspassrd" to the correct memory locations in flash.

    sal
  • Thank you, it worked!

    The file for the TMS320F28069 is F2806x_CSMPasswords.asm. This file does 2 things: it sets the 8 password locations, and it sets the 0x3F7F80 - 0x3F7FF5 locations to 0x0000, apparently necessary for password to work. However, launching a debug session in Code Composer to program the chip, the session aborts when trying to write these locations because the password is (apparently) programmed first, and locks out the programming utility.

    The chip still programs ok, and the password lock works, apparently because these locations are 0x0000 anyway (in my case); however, to prevent this, split the assembly language source file F2806x_CSMPasswords.asm into 2 files: a new F2806x_CSMPasswords.asm file and F2806x_CSMPasswords_prep.asm file. Then, remove the part of F2806x_CSMPasswords.asm that contains the code to set 0x3F7F80 - 0x3F7FF5 to 0x0000, and place it by itself in a new assembly file F2806x_CSMPasswords_prep.asm. Now, the new F2806x_CSMPasswords.asm and F2806x_CSMPasswords_prep.asm files replace the original F2806x_CSMPasswords.asm file.

    You will see these 2 files in the C/C++ Projects file listing in Code Composer. Exclude F2806x_CSMPasswords.asm from the build by right-clicking the file name in the C/C++ Projects file listing, and selecting “Exclude from Build” from the menu options, then launch debug session to compile, link, and load the program. Next, include F2806x_CSMPasswords.asm in the build by right-clicking the file name, and un-checking “Exclude from Build.” Then, select F2806x_CSMPasswords_prep.asm and exclude it from build. Re-run the debug session. This will complete programming the firmware and lock the chip. The session will abort when the system tries to read back to verify the values, but the firmware is programmed and the chip is locked. Exit Code Composer, and you’re done.

    Here's the 2 files from the original F2806x_CSMPasswords.asm file:

    The "new" F2806x_CSMPasswords.asm file:
    ;// TI File $Revision: /main/2 $
    ;// Checkin $Date: January 4, 2011 10:10:10 $
    ;//###########################################################################
    ;//
    ;// FILE: F2806x_CSMPasswords.asm
    ;//
    ;// TITLE: F2806x Code Security Module Passwords.
    ;//
    ;// DESCRIPTION:
    ;//
    ;// This file is used to specify password values to
    ;// program into the CSM password locations in Flash
    ;// at 0x3F7FF8 - 0x3F7FFF.
    ;//
    ;// In addition, the reserved locations 0x3F7F80 - 0x3F7FF5 are
    ;// all programmed to 0x0000
    ;//
    ;//###########################################################################
    ;//
    ;// Original source based on D.A.
    ;//
    ;// $TI Release: 2806x C/C++ Header Files and Peripheral Examples V1.00 $
    ;// $Release Date: January 11, 2011 $
    ;//###########################################################################

    ; The "csmpasswords" section contains the actual CSM passwords that will be
    ; linked and programmed into to the CSM password locations (PWL) in flash.
    ; These passwords must be known in order to unlock the CSM module.
    ; All 0xFFFF's (erased) is the default value for the password locations (PWL).

    ; It is recommended that all passwords be left as 0xFFFF during code
    ; development. Passwords of 0xFFFF do not activate code security and dummy
    ; reads of the CSM PWL registers is all that is required to unlock the CSM.
    ; When code development is complete, modify the passwords to activate the
    ; code security module.

    .sect "csmpasswds"

    .int 0xFFFF ;PWL0 (LSW of 128-bit password)
    .int 0xFFFF ;PWL1
    .int 0xFFFF ;PWL2
    .int 0xFFFF ;PWL3
    .int 0xFFFF ;PWL4
    .int 0xFFFF ;PWL5
    .int 0xFFFF ;PWL6
    .int 0xFFFE ;PWL7 (MSW of 128-bit password)

    ; END OF FILE.

    The "broken off" F2806x_CSMPasswords_prep.asm file:
    ; For code security operation, all addresses between 0x3F7F80 and
    ; 0x3F7FF5 cannot be used as program code or data. These locations
    ; must be programmed to 0x0000 when the code security password locations
    ; (PWL) are programmed. If security is not a concern, then these addresses
    ; can be used for code or data.

    ; The section "csm_rsvd" can be used to program these locations to 0x0000.

    .sect "csm_rsvd"
    .loop (3F7FF5h - 3F7F80h + 1)
    .int 0x0000
    .endloop

    ;//===========================================================================
    ;// End of file.
    ;//===========================================================================

    This works well.
  • How do I do that?

    I haven't used linker command files since I used to program TMS320F241 in assembly language.

    I haven't done anything with that in this case, and it does work.
  • Hi,

    I'm a bit confused. The section:
    .sect "csm_rsvd"
    .loop (3F7FF5h - 3F7F80h + 1)
    .int 0x0000
    .endloop

    takes care of the issue. Why 2 files ? I'm unable to understand where you got stuck!

    Regards,
    Gautam
  • It's an intermittent problem, where sometimes the Code Composer debug session will abort when trying to write 0x0000 to the upper 8 16-bit words of Sector A because it is locked out of the device. By dividing the .asm file into 2 files and making it a 2-part operation in which the zeros are written first, then the password is written (PWL0 - PWL7) after, the problem did not occur.

    Now, retrying it, the single .asm file works. I tried to get the abort error again to give you the exact message wording, but now it's fine. The problem is intermittent, not consistent. But the 2-part operation got rid of it -- reprogrammed numerous times without an issue.
  • Fine, keep us updated on the same if you've any issues.

    Regards,
    Gautam
  • Will do.

    Thank you very much for your help. I was stuck until you showed me that .asm file.

  • You're Welcome!

    Goodluck & Regards,
    Gautam