• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » C2000™ Microcontrollers » C2000 32-bit Microcontrollers Forum » CCS locked CSM on F2812
Share
C2000™ Microcontrollers
  • Forums
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
C2000 Resources
  • Product Folder
  • C2000 Training Portal
  • C2000 Technical Training Catalog
  • C2000 Datasheets, App Notes, User Guides
  • C2000 Hardware Design Kits
  • controlSUITE for C2000 Software Library


  • InstaSPIN Resources
  • What is InstaSPIN?
  • Videos and Support


  • InstaSPIN-FOC and InstaSPIN-MOTION Resources
  • What is InstaSPIN-FOC?
  • What is InstaSPIN-MOTION?
  • Product Folder: F28069F, F28068F, F28062F, F28068M, F28069M
  • User’s Guide
  • Technical User’s Manual
  • Tools
  • Forums

    CCS locked CSM on F2812

    This question is answered
    Gary Lynch
    Posted by Gary Lynch
    on May 02 2012 15:59 PM
    Expert1170 points

    I am attempting to port an app from boot-from-RAM to boot-
    from-flash using CCSv4 on an F2812 board I designed using
    the ezDsp as a template. I got one of these to work last
    week, but involved my own code only. This integrates code
    from my fellow programmer which has many more user-defined
    sections than my prior attempt.

    It took forever to overcome all the build errors, but when I
    finally tried to launch the debugger it terminated in an
    error message (I retrieved this after the fact from the
    error log):
    ]
    ] eclipse.buildId=4.2.4.00033
    ] java.version=1.5.0_14
    ] java.vendor=Sun Microsystems Inc.
    ] BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
    ] Command-line arguments:  -data C:\CodeComposer2 -os win32 -ws win32 -arch x86
    ]
    ] Error
    ] Wed May 02 11:41:33 EDT 2012
    ] Error: C28xx: Flash Programmer: Error erasing Flash memory.
    ]

    I clicked a button that allowed it to halt and tried again.
    The second attempt ended in:
    ]
    ] eclipse.buildId=4.2.4.00033
    ] java.version=1.5.0_14
    ] java.vendor=Sun Microsystems Inc.
    ] BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
    ] Command-line arguments:  -data C:\CodeComposer2 -os win32 -ws win32 -arch x86
    ]
    ] Error
    ] Wed May 02 11:41:33 EDT 2012
    ] Error: C28xx: Flash Programmer: Error erasing flash memory.
    ]        Device is locked or not connected. Operation cancelled
    ]
    Now any time I attempt to load an app that uses flash, or L0
    or L1 SARAM it dies with "Data verification failed at
    address ...".  The addresses I checked on were in L1SARAM.

    I can still load and run apps that place all code & data in
    the H0SARAM, and followed another posting on this forum
    indicating I could look at the addresses in 0x3F7FF8-
    0x3F7FFF in the data space using the Memory window. They all
    read back as 0000.

    Refreshing the display of those words and running a script
    from Scripts >> Code Security Module >> Unlock_CSM have no
    effect.

    1.  Have I exhausted all opportunities for salvaging my DSP
        board?

    Worst still, if the passwords have unknown values in them, I
    have no idea how they got there, nor how to keep from doing
    it again.  At $570 a board (and we only have 2 left) I can
    ill afford this category of education.

    I have uploaded the linker command file here:
    - http://my.execpc.com/~bookworm/Profession/LockCsm_cmd.html

    should anyone care to take a look at it. I can't think of
    anything else to volunteer (That was not its original name).

    Advance thanks for any money you can save my employer.

    ============================================================
    Gary Lynch    printf("lynchg%cstacoenergy%ccom", 55+9, 55-9)
    ============================================================

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Gary Lynch
      Posted by Gary Lynch
      on May 04 2012 09:48 AM
      Expert1170 points

      I have received as yet no responses to this query, but have
      continued to research and am adding my discoveries for
      future readers.

      1.  Other than the first time, every time you program the
          flash of your F2812, CCS erases the whole flash memory.
          The erase algorithm includes writing zeros to every
          memory location (including the CSM passwords), which is
          exactly what TI says YOU MUST NEVER DO, if you don't
          want to render the DSP unusable.

      2.  If Code Composer decides to dive into its naval
          immediately after zeroing out your passwords, you are
          through using this chip.  I suspect that is what
          happened to me.

      3.  Up until today, every flash programming example I had
          ever found for the F2812 assumed you were using CCSv3 or
          earlier, and was not very applicable to someone who has
          only used v4. But this morning I noticed that document
          SPRA958K:
          - http://www.ti.com/lit/an/spra958k/spra958k.pdf

          references (on page 1) a fileset inside spra958.zip
          which includes flash programming examples that are
          supposed to run under v4.

      4.  The aforementioned file set lacks a function:
            Uint16 CsmUnlock()

          that was present on all the other flash programming
          examples I had used, but which gave me build-time
          difficulties until I eliminated it from my source. This
          also could have caused me more difficulties.

      F.Y.I.

      ============================================================
      Gary Lynch    printf("lynchg%cstacoenergy%ccom", 55+9, 55-9)
      ============================================================

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • William Colley97918
      Posted by William Colley97918
      on May 04 2012 13:20 PM
      Verified Answer
      Verified by Gary Lynch
      Prodigy60 points

      If you all 128 PWL bits, the device is frozen forever in its current state.  It won't erase.  It won't debug.  If you've done that to a part inadvertantly, you'll have to replace the part.

      The fact that CsmUnlock() is cauing you build errors is a bad sign.  You probably are not defining the CSM password section in your load image.  You need to do that.  The Piccolo file DSP2803xCSMPasswords.asm should work fine for your processor as well.  Add it to your project.

      That file fills sections csm_rsvd and csmpasswds, so define those sections in your linker command file.  Define memory regions to load the sections into.  csm_rsvd needs to load into a memory region with org=0x3f7f80 and len=0x000076.  csmpasswds needs to load into a memory region with org=0x3f7ff8 and len=0x000008.  Both memory regions go on page 0, i,e. in flash.

      This will insure that your load image doesn't load zeroes into the eight PWL words and lock up your part.

      I took a look through a Piccolo example that uses CsmUnlock().  It accesses the PWL locations through a data structure on page 1 call CsmPwl.  It learns about that data structure via a header file included by master header file DSP2803x_Device.h.  The data structure is defined in file DSP2803x_GlobalVariableDefs.c.  You do have that either with your project sources or linked to the project, right?  Those many data structures are allocated to page 1 via the linker command file DSP2803x_Headers_nonBIOS.cmd.  You have that in the root directory of your project, right?  I'm sure there are equivalents for the 2812.

      You can have two linker command files in a project as long as they don't allocate the same spaces.  All of my projects have DSP2803x_Headers_nonBIOS.cmd right alongside my own linker command file that allocates the RAM and flash spaces.

      That's what I've got with the information you gave me.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Gary Lynch
      Posted by Gary Lynch
      on May 09 2012 08:29 AM
      Expert1170 points

      On Friday, May 04, 2012 3:52 PM; William Colley97918 wrote:
      >
      > That file (DSP28...CSMPasswords.asm) fills sections csm_rsvd
      > and csmpasswds, so define those sections in your linker
      > command file. Define memory regions to load the sections
      > into. csm_rsvd needs to load into a memory region with
      > org=0x3f7f80 and len=0x000076. csmpasswds needs to load into
      > a memory region with org=0x3f7ff8 and len=0x000008. Both
      > memory regions go on page 0, i,e. in flash.
      >
      > This will insure that your load image doesn't load zeroes
      > into the eight PWL words and lock up your part.
      >
      Several people (including Bruce Nielsen: off-line) have
      emphasized this point, which I was aware of before I
      attempted this port, and I thought I took that into account,
      as TI provided source for all those operations. 

      I tried to stress that in my original post, as well as a
      point I noticed from a slide show in the C2000 wiki entitled
      "TMS320F281x Flash Programming Solutions," SPRB169, and
      which is available as a pdf at:
      - http://www.ti.com/lit/ml/sprb169/sprb169.pdf

      According to slide 7, every time (other than the first) you
      program your device, it must first be erased, and one of the
      intermediate steps is to change all bits of each sector to
      all 0's (precisely what you must NEVER do to the PWLs).
      Several TI documents warn non-descriptly of the danger of
      pulling the plug or resetting your MCU during the erase
      cycle, and I had no intention of doing so.  It self-aborted.

      But I think I answered my own question when copying the
      project to a new workspace.  I originally created this
      project using the CCS new project wizard, and then copied
      all the files into it from two other projects containing the
      code I wanted to merge. I was careful to copy a pre-existing
      target configuration file from only one of the source
      projects, but apparently not careful enough.

      During the new copy I discovered there was another target
      configuration file in the project folder likely created by
      the wizard, which was marked as 'active', overriding my own
      .ccxml file and which may have had all defaults for the
      configuration values. I deleted it, making my own file the
      active one and now I can load my app into flash without MCU
      destruction.

      Thanks, Will (you get the prize), and to all who
      contributed off-line.

      ============================================================
      Gary Lynch    printf("lynchg%cstacoenergy%ccom", 55+9, 55-9)
      ============================================================

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lori Heustess
      Posted by Lori Heustess
      on May 09 2012 09:47 AM
      Guru50865 points

      Gary Lynch

      I can still load and run apps that place all code & data in
      the H0SARAM, and followed another posting on this forum
      indicating I could look at the addresses in 0x3F7FF8-
      0x3F7FFF in the data space using the Memory window. They all
      read back as 0000.

      Refreshing the display of those words and running a script
      from Scripts >> Code Security Module >> Unlock_CSM have no
      effect.

      1.  Have I exhausted all opportunities for salvaging my DSP
          board?

      Unfortunately it does sound like your device is locked.   One thing to try is please check is the VDD3VFL voltage.  Please make sure it is connected well and powered to 3.3.  This pin powers the flash and if it is not healthy the CSM will appear to be locked.

      I took a look at the linker command file and the only thing I see assigned to the password location is the "passwords" section.  If this is filled with all 0xffff then the code should be fine. 

      /* + + + + + + + + + + + + + + + + + + + */
      /*** Code Security Password Locations  ***/
      /* + + + + + + + + + + + + + + + + + + + */
         passwords              : > PASSWORDS,        PAGE = 0

      Gary Lynch
      1.  Other than the first time, every time you program the
          flash of your F2812, CCS erases the whole flash memory.
          The erase algorithm includes writing zeros to every
          memory location (including the CSM passwords), which is
          exactly what TI says YOU MUST NEVER DO, if you don't
          want to render the DSP unusable.


      Yes this is correct. Unfortunatly part of the erase process is to program all bits to 0. This is a requirement of the technology. If you can spare sector A, and keep your entry point to your code fixed, you can mark it to not be erased in the plug-in settings in CCS. This may help during development when the device is erased often.

      Gary Lynch
      2.  If Code Composer decides to dive into its naval
          immediately after zeroing out your passwords, you are
          through using this chip.  I suspect that is what
          happened to me.


      There is an amount of time where the password is 0 and then it becomes unknown - individual bits will become 1's at different rates. It is a dynamic process where charge is being removed slowly until the bits reach a solid 1. If this process is interrupted then the password could be 0 or it could be unknown. Due to security this will lock the device unfortunately.

      Gary Lynch

      3.  Up until today, every flash programming example I had
          ever found for the F2812 assumed you were using CCSv3 or
          earlier, and was not very applicable to someone who has
          only used v4. But this morning I noticed that document
          SPRA958K:
          - http://www.ti.com/lit/an/spra958k/spra958k.pdf

          references (on page 1) a fileset inside spra958.zip
          which includes flash programming examples that are
          supposed to run under v4.

      4.  The aforementioned file set lacks a function:
            Uint16 CsmUnlock()

          that was present on all the other flash programming
          examples I had used, but which gave me build-time
          difficulties until I eliminated it from my source. This
          also could have caused me more difficulties.



      I'll make note of this in our bug tracking database and revisit. The 281x is a bit old so the collateral is in need of an update. I regret you were not able to find an example easily for this device.

      -Lori
      Did a reply answer your question? If yes, please click the "yes" button located at the bottom of that post.
      Visit these helpful C2000 Links!
      C2000 TI Wiki Pages
      TI Forum Sitemap
      ControlSUITE
      C2000 Getting Started
      CLA FAQs
      Workshop Material!
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use