currently we have a SRAM mapped in the EIM - CS0 area 128MB. It works well.
Now we like to split the area in 2 regions with CS0 and CS1.
I used CS0 Registers and values as a template and as documented in the toradex knowledge-base.
It looks simple, but I had done something wrong.
If I read form CS1 area I got the data form CS0 area. I guess there is a register value not defined.
Please can you assist me, to find the error.
I will send you a schematic, but with my settings I see only the CS0 WE OE signals therefore it is normal to get
SRAM data all the time.
With my settings there is no CS1 signal activ. I think the problem is not the hardware (schematic) but my register definitions.
Please can you have a look at it, or an example. The lines 17 to 21 above I tried to split the EIM Bus
0x2800_0000 - 0x2FFF_FFFF in 32MB (0x1B), I tried also 0x1D (2* 64MB) without success…
The documentation of the register IOMUXC_GPR_GPR1 in NXP’s reference manual is not fully clear. There’s a definition in a source file on github (gprvals), which seems to be correct. Attention, the numbers are octal !
If I get it correctly, the values for the WEIM_ADDRSx fields are
00 = 32MB address space
01 = 64MB address space
10 = 128MB address space
11 = never used
Edit: I had a wrong interpretation of the values in my original answer (see below) ( 00 = no address space ) ( 01 = 32MB address space ) ( 10 = 64MB address space ) ( 11 = 128MB address space )
and there’s a statement The address space of the
first active chip select must be the biggest one, the following active chip select address spaces may be
equal or lower.
Your Code
The default value of the register IOMUXC_GPR_GPR1 is 0x0F40_0005.
Your statement …
*pRegister |= 0x1B;
…modifies this to 0x00F40_001F, which means
CS0 = invalid setting
CS1 = 64MB (overlapping the range of CS0)
I assume replacing it by the following statement should fix the issue
*pRegister = (*pRegister & ~0x3F) | 0x1B;
// I edited my original post, where I had missed the ~ operator.
It would be nice to get your feedback whether this helped.
A write and a read on each chip select looks as follows:
CH1: CS0 (SODIMM 105)
CH2: CS1 (SODIMM 107)
I assume the major error in your code was the value of IOMUXC_GPR_GPR1. The low 12 bits of this register must be configured to 0x01b (instead of 0x02d). I adjusted my previous answer accordingly.