This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

External memory problems with RTX

Hello,

Is there any tutorial / example or application note on using External SRAM with EMC and RTX ?

I'm using a LPC2378 and I have the RLARM library. The problem is that I need 40kRAM to get my program working but there's only 32kRAM inside. So I connected 64kRAM with the EMC module. But I don't understand how to get the EMC working with the RTOS.

kind regards,
Wim

  • this is not an RTX problem - RTX can run with or without external memory. check your EMC settings/RAM data sheet - they should not change whether you use RTX or not.

  • 1 - Get your EMC working
    2 - Configure the project to use the memory range covered by the external RAM

  • I have this in my startupcode:

    ;----------------------- External Memory Controller (EMC) Definitons -----------
    
    EMC_BASE            EQU 0xFFE08000      ; EMC Base Address
    
    EMC_CTRL_OFS        EQU 0x000           ; EMCControl
    EMC_STAT_OFS        EQU 0x004           ; EMCStatus
    EMC_CONFIG_OFS      EQU 0x008           ; EMCConfig
    EMC_STA_CFG0_OFS    EQU 0x200           ; EMCStaticConfig0
    EMC_STA_WWEN0_OFS   EQU 0x204           ; EMCStaticWaitWen0
    EMC_STA_WOEN0_OFS   EQU 0x208           ; EMCStaticWaitOen0
    EMC_STA_WRD0_OFS    EQU 0x20C           ; EMCStaticWaitRd0
    EMC_STA_WPAGE0_OFS  EQU 0x210           ; EMCStaticWaitPage0
    EMC_STA_WWR0_OFS    EQU 0x214           ; EMCStaticWaitWr0
    EMC_STA_WTURN0_OFS  EQU 0x218           ; EMCStaticWaitTurn0
    EMC_STA_CFG1_OFS    EQU 0x220           ; EMCStaticConfig1
    EMC_STA_WWEN1_OFS   EQU 0x224           ; EMCStaticWaitWen1
    EMC_STA_WOEN1_OFS   EQU 0x228           ; EMCStaticWaitOen1
    EMC_STA_WRD1_OFS    EQU 0x22C           ; EMCStaticWaitRd1
    EMC_STA_WPAGE1_OFS  EQU 0x230           ; EMCStaticWaitPage1
    EMC_STA_WWR1_OFS    EQU 0x234           ; EMCStaticWaitWr1
    EMC_STA_WTURN1_OFS  EQU 0x238           ; EMCStaticWaitTurn1
    EMC_STA_EXT_W_OFS   EQU 0x880           ; EMCStaticExtendedWait
    
    BUFEN_Const         EQU (1 << 19)       ; Buffer enable bit
    EMC_PCONP_Const     EQU (1 << 11)       ; PCONP val to enable power for EMC
    
    ; External Memory Pins definitions
    ; pin functions for external memory interfacing
    EMC_PINSEL6_Val     EQU 0x00005555      ; D0 .. D7
    EMC_PINSEL8_Val     EQU 0x55555555      ; A0 .. A15
    EMC_PINSEL9_Val     EQU 0x50090000;     ; !OE, !WE (BLS0 because of errata), !CS0, !CS1
    
    ;//     External Memory Controller Setup (EMC) ---------------------------------
    ;// <e> External Memory Controller Setup (EMC)
    EMC_SETUP           EQU 1
    
    EMC_CTRL_Val        EQU 0x00000001
    
    EMC_CONFIG_Val      EQU 0x00000000
    
    
    EMC_STACS0_SETUP    EQU 1
    
    EMC_STA_CFG0_Val    EQU 0x00000000
    
    EMC_STA_WWEN0_Val   EQU 0x00000009
    
    EMC_STA_WOEN0_Val   EQU 0x0000000A
    
    EMC_STA_WRD0_Val    EQU 0x0000001F
    
    EMC_STA_WPAGE0_Val  EQU 0x0000001F
    
    EMC_STA_WWR0_Val    EQU 0x0000001F
    
    EMC_STA_WTURN0_Val  EQU 0x0000000F
    
    EMC_STA_EXT_W_Val   EQU 0x00000013
    
    

    and this in my task init()

            PCONP |= (1 << 11);
            PINSEL6 &= ~0x0003FFFF;
            PINSEL6 |= 0x00015555;
            PINSEL8 &= ~0xFFFFFFFF;
            PINSEL8 |= 0x55555555;
            PINSEL9 &= ~0xF00F0000;
            PINSEL9 |= 0x50090000;
    

    I'm using www.amictechnology.com/.../A623308.pdf SRAM

    I think the system crashes when it wants to write to the external RAM.

  • OMG :x

    I made a huge beginner mistake here.

    I installed 64kbit RAM instead of 64kByte RAM.

    Embarrising lol

  • Thank you for supplying the reason for your problem.