External SDRAM with EMC

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

External SDRAM with EMC

1,673 Views
dimitrissideris
Contributor III

Hi there,

I have a custom pcb mounted with an LPC4367 and interfaced with EMC an external sdram IS42S16320D of 512Mbit.

I have followed AN11508 and set up emc and sdram timings.

I have ported from lpcopen 3.01 for keil the process of initialization of EMC and sdram. I have also ported and run the memtest that lpcopen 3.01 provides (periph_memtest) and sdram works fine.

After setting up the emc and sdram i am kind of confused how to use the external sdram.

I have some questions.

1.

What is the suggested procedure to correclty use external sdram?

Do i have to go to Project-Settings-MCU and add the new sdram?

Do i have to manually modify the linker script?

Both?

I have only found scattered information and not a complete guide of how to use external sdram

2.

In lpcopen 3.01 for keil 4357 (which i follow and port various things from there to my custom pcb)

in periph_lcd example the only thing i see regarding sdram is the below line:

static uint16_t *framebuffer = (uint16_t *) FRAMEBUFFER_ADDR;

where FRAMEBUFFER_ADDR is 0x28000000 which is the memory emc puts external sdram. I also configured emc for my custom pcb the same way. 0x28000000 is my base sdram address.

I see nowhere in project setting of adding a new ram block or any mention to that address in linker script or any use of cr_section_macros.h.

Is just declaring a pointer or a variable like the

static uint16_t *framebuffer = (uint16_t *) FRAMEBUFFER_ADDR

enough for using sdram?

NXP, I need some help and explanation.

Please don't post the obvious answers and links without any explanation like

Placing data into different RAM blocks 

Allocating dynamic memory in External SDRAM 

and links that google search returns.

I have read those and weren't concrete enough to get the whole picture.

Thanks a lot in advance!

0 Kudos
Reply
4 Replies

1,406 Views
lpcxpresso_supp
NXP Employee
NXP Employee

So if you use a pointer to access the SDRAM in this manner, then you won't need to necessarily configure the SDRAM in the IDE's memory configuration. However I would suggest doing so, as this means that the IDE will be able to pass the memory configuration details to the debugger.

Regards,

LPCXpresso Support

0 Kudos
Reply

1,406 Views
dimitrissideris
Contributor III

Thanks a lot that made it clear.

FYI there is another post that i have moved forward and still having some issues with external sdram.

https://community.nxp.com/message/922580?commentID=922580#comment-922580 

You can consider this thread closed.

Thanks a lot!

0 Kudos
Reply

1,406 Views
lpcxpresso_supp
NXP Employee
NXP Employee

You should define a region for your SDRAM using the LPCXpresso Memory Configuration Editor (information available in the User's Manual and FAQ section of this site). Once you have a SDRAM memory region, you can allocate code/data to it. The Managed Linker script mechanism will incorporate the new memory region in the generated linker scripts as part of the next build. Read up on the cr_sections_macro.h header. This header file contains convenient macros for allocating code/data to particular memory regions. This is covered in one of the links you posted.

Note also, the EMC must be setup prior to executing the LPCXpresso startup code which copies code and/or initialized data, and clears bss presuming you're using the SDRAM region for this purpose. You'll add the SDRAM setup to the LPCXpresso ResetISR() entry (cr_startup_lpc43xx.c) before the calls to either data_init() or bss_init().

Thanks and regards,

LPCXpresso Support

EDIT:  Here's a link to application note AN11508 SDRAM interface to LPC18xx/43xx EMC in case needed by anyone else.

0 Kudos
Reply

1,406 Views
dimitrissideris
Contributor III

Hi,

Thanks for replying!

For initializing EMC i follow the procedure of the examples of lpcopen 3.01 for keil where there is a external sdram initialization.

In all the examples no memory region is added in mcu settings nor there is no mention to sdram and its address in the linker scripts.

Sdram is usded just by declaring a framebuffer to the start of sdram address.

"""

static uint16_t *framebuffer = (uint16_t *) FRAMEBUFFER_ADDR

"""

Are lpcopen examples valid?

0 Kudos
Reply