XPC567XRKIT: How to use external SRAM correctly

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

XPC567XRKIT: How to use external SRAM correctly

1,216 Views
nuaa_zp
Contributor I

Hello everybody,

I am facing an issue on   MPC567XKIT516-PT Development board. MCU is MPC5674F.

The internal SRAM is too little to handle my program,so I want to use an external SRAM. I have successfully initialized external SRAM according to the sample(XPC567XRKIT PinToggleStationery CW210 example,SRAM is CY7C1338 and this is 4Mbit memory,address range is 0x2000_0000 - 0x2007FFFF),and test OK by using the follow code:

/* test write */
*(vuint32_t*)(0x20000000) = 0xAA55AA55;

/* test read */
longword0 = *(vuint32_t*)(0x20000000);

/* evaluation */
if (longword0 == 0xAA55AA55)
{
         printf("External SRAM initialized properly\r\n");
}
else
{
         printf("External SRAM test failed\r\n");
}

But I don't know how to add it to memory,for example, when used, the compiler can automatically allocate memory.

I think the LCF file needs to be modified (debug mode),But when I change the following variables 'pseudo_rom or internal_ram' to 'external_ram', the program will run abnormally. Please tell me how to use external SRAM correctly.@#@@

MEMORY
{

      external_ram: org = 0x20000000, len = 0x00080000     //My changes
      pseudo_rom: org = 0x40008000, len = 0x00020000
      init: org = 0x40028000, len = 0x00001000
      exception_handlers: org = 0x40029000, len = 0x00001000
      internal_ram: org = 0x4002A000, len = 0x00014000
      heap : org = 0x4003E000, len = 0x00001000 /* Heap start location */
      stack : org = 0x4003F000, len = 0x00001000 /* Start location for Stack */
}

SECTIONS
{
      GROUP : {
                  .init : {}
                  .init_vle (VLECODE) : {
                  *(.init)
                  *(.init_vle)
                           }
                  } > init

.__exception_handlers (VLECODE): {} > exception_handlers

GROUP : {
         .text (TEXT) ALIGN(0x10) : {}
         .text_vle (VLECODE) ALIGN(0x10): {
         *(.text)
         *(.text_vle)
                     }
            .rodata (CONST) : {
         *(.rdata)
         *(.rodata)
            }
         .ctors : {}
         .dtors : {}
         extab : {}
         extabindex : {}
         } > pseudo_rom

GROUP : {
         .__uninitialized_intc_handlertable ALIGN(0x10) : {}
         .data : {}
         .sdata : {}
         .sbss : {}
         .sdata2 : {}
         .sbss2 : {}
         .bss : {}
         } > internal_ram
}

Thank you in advance for your help!

peng

Labels (1)
0 Kudos
4 Replies

1,039 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, such example you may find here:

https://community.nxp.com/docs/DOC-344472 

0 Kudos

1,038 Views
nuaa_zp
Contributor I

Hi, David

I also refer to this code for modification based on ‘XPC567XFKIT-PinToggleStationery-V0_6’, put the initialization code of SRAM into usr_init, and define INIT_EXTERNAL_BUS_INTERFACE_SETUP as 1, define  INITIALIZE_EXTERNAL_SRAM as 0.

External SRAM read-write test OK,I think there should be no problem with SRAM configuration.But when I change ‘pseudo_rom’ in LCF to my newly defined ‘external_ram’, the compilation will report errors.I don't know why. Please give me some advice.In addition to SRAM related initialization, what other configurations need to be modified.

Thanks a lot!

Attach my test code.

0 Kudos

1,038 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Mentioned example code just show how to modify linker command file. Please pay attention to that.

pastedImage_26.png

It was prepared by Codewarrior expert by modification of my original code that only setup EBI module. But this example should execute from external RAM thus it should not be difficult to adapt it to the MPC5676R

Example MPC5644A External SRAM - CodeWarrior for MCUs v10.5 

0 Kudos

1,038 Views
nuaa_zp
Contributor I

Hi, David,

There are two questions to ask:

1)In the schematic diagram provided by the development board, SRAM is connected as follows:

pastedImage_1.png

But the connection mode of SRAM recommended in mpc5674f reference manual is as follows:

pastedImage_2.png

so I do not know how to connect.

2)The schematic diagram of the development board says that CY7C1471(2m * 36) can be used, but the connection mode seems incompatible. It has no ADSP and ADSC pins, only ADV/ LD pins. If I want to use CY7C1471, how can I connect with EBI of 5674F?

pastedImage_3.png

0 Kudos