• 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 » Hercules™ Safety Microcontrollers » Hercules™ Safety Microcontrollers Forum » Stuck in _memoryInit_ loop
Share
Hercules™ Safety Microcontrollers
  • Forum
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

Stuck in _memoryInit_ loop

This question is answered
Marius Niculescu
Posted by Marius Niculescu
on May 10 2012 19:55 PM
Prodigy160 points

I need help with my first Halcogen-generated project which is now getting stuck in an infinite loop in _memoryInit_ on the RM48 USB Stick. Previously it used to run and I cannot determine what I changed to cause this issue. Here is the memoryInit function as generated by Halcogen:

.def _memoryInit_
.asmfunc

_memoryInit_

stmfd sp!, {r0-r2}
ldr r2, regMinitGcr ; MINITGCR register pointer
mov r0, #0xA
str r0, [r2]
ldr r0, ramInitMask ; load RAM initialization mask
str r0, [r2, #4]
mloop
ldr r1, [r2, #12]
tst r1, #0x100
beq mloop
mov r0, #5
str r0, [r2]
ldmfd sp!, {r0-r2}
bx lr

ramInitMask .word 0x1C57F
regMinitGcr .word 0xFFFFFF5C

.endasmfunc

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Kevin Lavery
    Posted by Kevin Lavery
    on May 11 2012 08:02 AM
    Intellectual1460 points

    Marius,

    Can you try something quick? Try changing the first instruction after mloop from ldr r1, [r2, #12] to ldr r1, [r2, #8].

    Regards,

    TI Forum Support

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Marius Niculescu
    Posted by Marius Niculescu
    on May 12 2012 18:42 PM
    Prodigy160 points

    I have not been able to replicate the issue anymore. The only change I made was to shut down my computer and start it again. If I encounter the problem again, I will try your suggestion.

    Thanks,

    Marius

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Marius Niculescu
    Posted by Marius Niculescu
    on May 13 2012 17:39 PM
    Prodigy160 points

    The problem started happening again, consistently. Again I'm not sure what I did to trigger it. I tried your suggestion and I saw no change. I tried re-generating Halcogen code, same result. I unplugged the RM48USB stick and plugged it back in, same result. I restarted Code Composer, rebuilt my project, same result. I rebooted my computer, same result.

    The following day I was working with a TMS570 HDK and using a different PC, and after about 1 hour this system also started getting stuck in _MemoryInit_. Just as before, I'm not sure if my actions caused it, it just seemed to happen "out of the blue".  The source code for the memory init function in this TMS570 project is very similar:

    .def _memoryInit_
    .asmfunc

    _memoryInit_

    stmfd sp!, {r0-r2}
    ldr r2, regMinitGcr ; MINITGCR register pointer
    mov r0, #0xA
    str r0, [r2]
    ldr r0, ramInitMask ; load RAM initialization mask
    str r0, [r2, #4]
    mloop
    ldr r1, [r2, #12]
    tst r1, #0x100
    beq mloop
    mov r0, #5
    str r0, [r2]
    ldmfd sp!, {r0-r2}
    bx lr

    ramInitMask .word 0x1E57F
    regMinitGcr .word 0xFFFFFF5C

    .endasmfunc

    Trying your suggested change, I see no change. After I pressed the PORRST button on the HDK board, I can't even load code on the board anymore, I'm always getting the following error:

    CortexR4: Trouble Writing Memory Block at 0x0 on Page 0 of Length 0x3568
    CortexR4: GEL: File: <...>\workspace\RTI Test\Debug\RTI Test.out: Load failed.

    After this, turned off power to the HDK board, disconnected the debugger USB cable, shut down Code Composer, then connected a J-link debugger, started IAR EWARM, powered the board, loaded a known good project in EWARM and was able to upload it to flash and run it in debug mode, no more problems.

    Finally, I reverted back to using Code Composer Studio (v. 5.2 beta) with the integrated XDS100 debugger, and loaded the original project I was having problems with and now I was able to load it and run it, no more problems with loading code or with the memory test loop, using exactly the same project binary as previously.

    At this point I suspect the problem is caused either by the 5.2 beta version of Code Composer, or by the XDS100 JTAG debugger. 

    Thanks,

    Marius

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Kevin Lavery
    Posted by Kevin Lavery
    on May 14 2012 11:55 AM
    Verified Answer
    Verified by Marius Niculescu
    Intellectual1460 points

    Marius,

    Device Errata 152 could create this problem (meminit hanging) when a RAM's power domain is powered down.  The reset creates the possibility that this problem is generated.

    This problem is fixed so that when you order parts for production, you will not run into this problem.

    Regards,

    TI Forum Support

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bindu Tanguturi
    Posted by Bindu Tanguturi
    on Jun 29 2012 06:46 AM
    Expert1180 points

    Hi,

    I have seen the same problem with TMS570 MCU developement kit that we are using. The processor is TMs570LS20216.

    Let me know whether the same reason (device errata 152) for this device getting stuck in meminit function ?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Kevin Lavery
    Posted by Kevin Lavery
    on Jun 29 2012 08:10 AM
    Intellectual1460 points

    Hello,

    I do not think that the same errata applies to 570LS20216. Can you send some details on how you are configuring the meminit function?

    Regards,

    Forum Support

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bindu Tanguturi
    Posted by Bindu Tanguturi
    on Jul 02 2012 02:27 AM
    Expert1180 points

     

    I am using the code generated from HALCogen. Below is the code. Please let me know what is the issue with code.

     

    ; Initialize memory

        .global  _memoryInit_
        .asmfunc

    _memoryInit_:
           
            ldr   v9, regMinitGcr    ; MINITGCR register pointer
            mov   v1, #0xA
            str   v1, [v9]
            mov   v1, #0x657F
            str   v1, [v9, #4]
    mloop:
            ldr   v2, [v9, #12]
            tst   v2, #0x100
            beq   mloop
            mov   v1, #5
            str   v1, [v9]
            bx    lr
       
    regMinitGcr:   .word 0xFFFFFF5C

        .endasmfunc

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Kevin Lavery
    Posted by Kevin Lavery
    on Jul 02 2012 07:57 AM
    Intellectual1460 points

    Hello,

    What device are you initializing?

    Regards,

    Forum Support

    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