How to read/write external memory using EBI module

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

How to read/write external memory using EBI module

1,382 Views
jagadeeshalaksh
Contributor II


Hi Team,

 

I am new to MPC5566, trying to interface MR4A16B SRAM to MPC5566 using EBI module.

- I configured EBI register

- Configured corresponding SIU_PCR register to select the requried functionality.

 

Now, my doubt is how to Read/Write address/data... which register i need to use to write/read.

eg: CS[0] functionality is choosen from SIU_PCR register. if i want to make CS[0] line HIGH or LOW how to drive?

 

PLease help in understandig this and to solve.

 

 

Regards

Jagadeesha

Labels (1)
1 Reply

989 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

CW stationery contains initialization for the external memory that is present on EVB. See file MPC5566_HWInit.c, function INIT_ExternalBusAndMemory.

Internal address space is defined fixed within range 0x2000_0000-0x3FFF_FFFF. That’s fixed.

For particular chip selects you can select ranges (that must be within EBI range above and not overlapped) using base address EBI_BRn[BA] and address mask EBI_ORn[AM]. Address mask actually specifies size of address space addressed by particular chip select.

Base address and mask are both in format: 0b111x_xxxx_xxxx_xxxx_x000_0000_0000_0000

Ones from left side are taken from EBI fixed address range and zeros from right side specifies address granularity that is minimum CS addressable area (2^15 = 32kB).

CS lines are automatically driven during access to the particular CS area, for instance see following read and write considering basese address is set for 0x20000000:

vuint32_t longword0 = 0;

/* test write */

*(vuint32_t*)(0x20000000) = 0xBABADEDA;

/* test read */

longword0 = *(vuint32_t*)(0x20000000);

Note that also MMU table entry must be set properly to allow access to external bus space (function INIT_ExternalBusAndMemory handles it as well).