• 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 » MSP430™ Microcontrollers » MSP430 Ultra-Low Power 16-bit Microcontroller Forum » MSP430f2619 Flash Memory Controller questions
Share
MSP430™ Microcontrollers
  • Forum
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
MSP430 Resources
  • MSP430 Product Folder
  • MSP-EXP430G2 - MSP430 LaunchPad Value Line Development kit
  • MSP430 Getting Started Guide
  • MSP430 Microcontroller Projects
  • More Resources >
  • Forums

    MSP430f2619 Flash Memory Controller questions

    This question is not answered
    Chris Jones73762
    Posted by Chris Jones73762
    on Jul 23 2012 13:58 PM
    Prodigy60 points

    I have been able to successfully write and erase to Segment C of the Flash Information Memory. The problem I have is that the CPU hangs long after the erase has seemed to complete. I am using the WDT and disabling it during my erase routine and re-enabling it after it has completed. Then some time after it has moved on to other code, I get a WDT reset. If the CPU hung right after the dummy write that should be triggering the erase it wouldn't reset because I've disabled my WDT. Because it seems to be happening after, there is no way for me to know when to enable my WDT again.

      Here is my code:

    void erase_FLASH(unsigned int *Flash_ptr)
    {
      unsigned int *erase_ptr;
     

        WDTCTL = WDTPW + WDTHOLD;                     //    Stop WDT
          FCTL2 = FWKEY + FSSEL0 + FN5 + FN4;             // MCLK/48 for Flash Timing Generator
         FCTL3 = FWKEY;                            // Clear Lock bit.
         FCTL1 = FWKEY + ERASE;                                     // Set Erase bit
     

          erase_ptr = (unsigned int *)Flash_ptr;                    // copy Flash pointer into erase pointer
          *erase_ptr = 0;                                       // dummy write to erase Flash segment.


        FCTL3 = FWKEY + LOCK;
        CLRWDT();                                     //    Setup and clear WDT
    return;
    }

    Thank you for your help,

    Flash erase MSP430F2619
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • old_cow_yellow
      Posted by old_cow_yellow
      on Jul 23 2012 14:58 PM
      Guru25715 points

      After you LOCKed FCTL3, you can go ahead and do what ever you want the CPU to do.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Chris Jones73762
      Posted by Chris Jones73762
      on Jul 23 2012 15:33 PM
      Prodigy60 points

      That is the problem, the CPU hangs long after I LOCK the flash. I was expecting the CPU to hang sometime before this.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on Jul 24 2012 14:01 PM
      Guru139900 points

      Chris Jones73762
      That is the problem, the CPU hangs long after I LOCK the flash. I was expecting the CPU to hang sometime before this.

      This might be a misinterpretation of what you observe.

      When you do the 'dummy write', the flash controller will start the erase and disable the flash access. However, the CPU will simply continue, reading teh next instruction. Now the flash is inoperable, the flash controlelr will simply return 0x3fff, which teh CPU will itnerpret as 'JMP $'. No harm done. As soon as the flash is operable again, it will get the 'real' instruciton and continue.

      However, if you had a breakpoint on the instruction after the dummy write, it will be triggered by the first attempt of the CPU to read the next instruction. Right at the start of the erase cycle.

      Keep in mind that the breakpoints are 'instruciton fetch breakpoints' and not 'instruciton execution breakpoints'.

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Chris Jones73762
      Posted by Chris Jones73762
      on Jul 24 2012 17:50 PM
      Prodigy60 points

      Thank you for your response, while seeing the problem I thought exactly the same thing. Unfortunately, I see the problem even when not debugging or halting on a break point. I have set some LEDs to blink at different  intervals and another LED to light only while in my erase routine. Once the LED that indicates I am in the erase routine goes off, (meaning I have left the routine, erase should have finished) then my other LEDs that are blinking on regular intervals hang and the WDT resets. All signs point to the erase happening immediately. (ie: I can set a while loop in my erase routine to wait for the memory to read back 0xFFFF) But then I get this strange CPU hang after leaving the erase routine. Without the erase routine in my code my code executes without any WDT resets.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on Jul 25 2012 09:09 AM
      Guru139900 points

      I noticed that in your erase funciton you do not disable interrupts.

      While an erase is in progress, flash is not available. Any request will be responded with 0x3fff. While this will make the CPU jump in place, it will also return 0x3fff as the ISR address for any incoming interrupt. Then the PC will be loaded with 0x3fff and then jump there on place until the erase is done. Once the flash controller is done, the cpu will try to execute code at 0x3ffe (LSB ignored) with interrupts disabled.
      Depending on what the flash content at 0x3ffe is, anything can happen.

      BTW: if the WDT is active, you should reset it before you trigger the erase. :) (and immediately after)

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Chris Jones73762
      Posted by Chris Jones73762
      on Jul 25 2012 10:56 AM
      Prodigy60 points

      No luck.... this is my code now:

      void erase_FLASH(unsigned int *Flash_ptr)
      {
          
        unsigned int *erase_ptr;
       
          LED2_ON;
          ISR_OFF;                                                                                             // defined as _BIC_SR(GIE)
          WDTCTL = WDTPW + WDTHOLD + WDTCNTCL;                     //    clear and Stop WDT
            FCTL2 = FWKEY + FSSEL0 + FN5 + FN4;             // MCLK/48 for Flash Timing Generator
           FCTL3 = FWKEY;                            // Clear Lock bit.
           FCTL1 = FWKEY + ERASE;                                     // Set Erase bit
       
           erase_ptr = (unsigned int *)Flash_ptr;                    // copy Flash pointer into erase pointer so that flash
           *erase_ptr = 0xFFFF;                                       // dummy write to erase Flash segment.


          FCTL3 = FWKEY + LOCK;
                          
          CLRWDT();                                     //    Setup and clear WDT defined as WDTCTL = ( WDTPW | WDTCNTCL | WDTSSEL )
          LED2_OFF;
          ISR_ON;                                        // defined as _BIS_SR(GIE)
      return;

      Still causes my device to reset. Because WDT is disabled during the erase function the hang must be happening after I re-enable. If I never re-enable it my device no longer resets but I can see a definate hang from my timer LEDs.

      Thanks for your continued help.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Michael S
      Posted by Michael S
      on Jul 30 2012 12:21 PM
      Genius9640 points

      Hi team,

      Is there an update available regarding this inquiry?

      Regards,

      Regards,

      Michael S.

      ACSC Digital Apps

       

      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