• 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 » RM48 EMIF Module in Halcogen
Share
Hercules™ Safety Microcontrollers
  • Forum
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

RM48 EMIF Module in Halcogen

This question is answered
Vanderwegen Martin
Posted by Vanderwegen Martin
on Apr 05 2012 08:28 AM
Prodigy60 points

Hi,

I'm trying to use the EMIF module of the RM48 using halcogen in order to use the 8MB SDRAM.

To configure it I've done the following steps:

1. Create a RM4x, TMDXRM48HDK project.

2.  Set EMIF driver in Driver Enable Tab

3. Enable EMIF SDRAM in EMIF General

4. Set EMIF SDRAM Config with the ISSI datasheet

In CCS:

In sys_link.cmd:

I add -heap 0x7F0000

 in MEMORY : SDRAM (RW) : origin=0x80000020 length=0x007FFFE0

and in SECTIONS : .sysmem : {} > SDRAM  like in the RM48 Hercules Demo project.

in sys_main.c

I call emif_SDRAMInit() before the dynamic allocations.

The dynamic allocation seem work perfectly. However, the realloc function responds "NULL"

What can I do to solve this problem ?

Any help would be appreciated.

Martin V.

EMIF SDRAM
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Jean-Marc Mifsud
    Posted by Jean-Marc Mifsud
    on Apr 05 2012 11:04 AM
    Expert8985 points

    Martin,

    In order to help you the best, can you post the Halcogen configuration file you are using.
    The sys_main.c file you are using may also be useful to me.

    I would like to reproduce the problem in the same conditions.

    Thanks and Regards,

    Jean-Marc

    Best regards,

    Jean-Marc

    Application Engineer


    If my reply answers your question please click on the green button "Verify Answer".

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vanderwegen Martin
    Posted by Vanderwegen Martin
    on Apr 06 2012 03:19 AM
    Prodigy60 points

    Hi Jean-Marc,

    Thank you for the prompt response.

    The files :

    0116.emif_test.zip

    Martin V.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jean-Marc Mifsud
    Posted by Jean-Marc Mifsud
    on Apr 10 2012 14:39 PM
    Suggested Answer
    Expert8985 points

    Martin,

    I was able to test your code and I have some question and comments.

    Which version of Halcogen are you using?

    Concerning the heap size, when I've first try your sys_main, I was facing the same problem.
    The calloc() are working fine, but after calling the realloc I was getting NULL pointer.

    In my case, I did not specify any particular heap size. By default the linker uses 0x800 (bytes)
    So that was my problem.

    1] calloc(100, sizeof(int)) for tab you need 100 words (400 bytes)
    2] calloc(100, sizeof(int)) for tab2 you need 100 words (400 bytes)
    3] calloc(100, sizeof(int)) for tab3 you need 100 words (400 bytes)
    4] calloc(100, sizeof(int)) for tab2 you need 100 words (400 bytes)
    5] free(tab) deallocate 100 words
    6] calloc(2, sizeof(int)) for tab you need 2 words (8 bytes) The pointer stays the same as per old tab.
    7] realloc(150, sizeof(int)) for tab you need 150 words (600 bytes) This time the pointer has to move to a higher address.
    8] realloc(150, sizeof(int)) for tab2 you need 150 words (600 bytes) This time the pointer has to move to a higher address.
    now there is 100 + 100 words available at the address of first allocation for tab.
    9] realloc(150, sizeof(int)) for tab3 you need 150 words (600 bytes) This time the pointer has to move to a higher address.
    10] realloc(150, sizeof(int)) for tab4 you need 150 words (600 bytes) This time the pointer will be assigned at an address between the original tab2 and tab3.

    So for the worst case, you need 400 + 300 words of heap (700 words -> 2800 bytes -> 0xAF0)

    I think the runtime library also needs so heap size. In my test, I defined the heap to be 0xd00 and the code works fine.

    In your original post, you defined a heapsize way bigger than the physical ram size on this device. I don't know why you are doing that.

    In the sys_link, you should have:

    /*----------------------------------------------------------------------------*/
    /* Memory Map                                                                 */

    MEMORY
    {
        VECTORS (X)  : origin=0x00000000 length=0x00000020
        FLASH0  (RX) : origin=0x00000020 length=0x0017FFE0
        FLASH1  (RX) : origin=0x00180000 length=0x00180000
        STACKS  (RW) : origin=0x08000000 length=0x00001500
        RAM     (RW) : origin=0x08001500 length=0x00026B00

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

    /* USER CODE BEGIN (3) */
    --heap_size 0xd00

    /* USER CODE END */


    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */

    SECTIONS
    {
        .intvecs : {} > VECTORS
        .text    : {} > FLASH0 | FLASH1
        .const   : {} > FLASH0 | FLASH1
        .cinit   : {} > FLASH0 | FLASH1
        .pinit   : {} > FLASH0 | FLASH1
        .bss     : {} > RAM
        .data    : {} > RAM

    /* USER CODE BEGIN (4) */
        .sysmem  : {} > RAM
    /* USER CODE END */
    }

    Can you have a try with this definition and let me know the result?

    Thanks and Regards,

    Best regards,

    Jean-Marc

    Application Engineer


    If my reply answers your question please click on the green button "Verify Answer".

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vanderwegen Martin
    Posted by Vanderwegen Martin
    on Apr 11 2012 03:21 AM
    Prodigy60 points

    Jean-Marc,

    I use Halcogen 03.00.01

    I tried your code and it work, but I did the same modification before activating EMIF module to use the 8MB of SDRAM.

    This code is juste a try to reproduce problem with SDRAM.

    I need to allocate dynamically the whole SDRAM.

    I apologize for the lack of clarity in my first post.

    In the sys_link, I have:

    /*----------------------------------------------------------------------------*/
    /* Memory Map                                                                 */

    MEMORY
    {
        VECTORS (X)  : origin=0x00000000 length=0x00000020
        FLASH0  (RX) : origin=0x00000020 length=0x0017FFE0
        FLASH1  (RX) : origin=0x00180000 length=0x00180000
        STACKS  (RW) : origin=0x08000000 length=0x00001500
        RAM     (RW) : origin=0x08001500 length=0x00026B00

        SDRAM (RW) : origin=0x80000020 length=0x007FFFE0

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

    /* USER CODE BEGIN (3) */
    --heap_size 0x7F0000

    /* USER CODE END */


    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */

    SECTIONS
    {
        .intvecs : {} > VECTORS
        .text    : {} > FLASH0 | FLASH1
        .const   : {} > FLASH0 | FLASH1
        .cinit   : {} > FLASH0 | FLASH1
        .pinit   : {} > FLASH0 | FLASH1
        .bss     : {} > RAM
        .data    : {} > RAM

    /* USER CODE BEGIN (4) */
        .sysmem  : {} > SDRAM
    /* USER CODE END */
    }

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jean-Marc Mifsud
    Posted by Jean-Marc Mifsud
    on Apr 12 2012 14:07 PM
    Verified Answer
    Verified by Vanderwegen Martin
    Expert8985 points

    Martin,

    I did try your code, and after EMIF init, I'm not able to access the SDRAM memory correctly.
    Because the SDRAM is not working, the CALLOC and REALLOC are not working.

    In your HAlcogen project, the EMIF config is not specified (all timing are 0)

    I've modified the configuration for EMIF and PINMUX (a good number of EMIF signals are multiplexed with other function), generated and compiled the code and now it works.

    In my case, the EMIF.h file seems to have a problem.

    enum emif_pins
    {
        emif_PIN_0 = 0,
        emif_PIN_0 = 1
    };

    to be changed as

    enum emif_pins
    {
        emif_PIN_0 = 0,
        emif_PIN_1 = 1
    };

    After this modification, the code compiles and links correctly and the runtime functionality is the one you expect.

    I've informed the HalcoGen team about this problem and it will be fixed in the next release.

    I want to remind you that inside Halcogen, you can check for update. (Help->Check for Update).

    Here is the full 7215.EMIF.zip. Have a try and let me know.

    Regards,

    Jean-Marc

    Best regards,

    Jean-Marc

    Application Engineer


    If my reply answers your question please click on the green button "Verify Answer".

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vanderwegen Martin
    Posted by Vanderwegen Martin
    on Apr 16 2012 05:04 AM
    Prodigy60 points

    Jean-Marc,

    Thank you very much for your help.

    It works fine now.

    Regards,

    Martin.

    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