Hello All,
I am trying to get a 16-bit SDRAM (MT48LC16M16A2-75) to work with the AT91RM9200 and no matter what I try, it fails to work properly:
Hardware connections: AT91RM9200 MT48LC16M16A2
---------- ------------- D0-15 DQ0-15 A2-A11 A0-A9 SDA10 A10 A13-A14 A11-A12 BA0/1 BA0/1 SDCKE CKE SDCK CLK \BS0/1 DQML/H \RAS \RAS \CAS \CAS \SDWE \WE \SDCS \CS
Init code: volatile int *pRegister;
pRegister = (int *)0xFFFFFF98; // SDRAMC_CR *pRegister = 0x2188C159;
pRegister = (int *)0xFFFFFF90; // SDRAMC_MR *pRegister = 0x00000012; // 16-bit, precharge all on access pRegister = (int *)0x20000000; *pRegister = 0; pRegister = (int *)0xFFFFFF90; // SDRAMC_MR *pRegister = 0x00000014; // 16-bit, refresh on access pRegister = (int *)0x20000000; // MT48LC16M16A2TG-75 requires 2 refreshes *pRegister = 0; // But do 8 like all examples *pRegister = 0; *pRegister = 0; *pRegister = 0; *pRegister = 0; *pRegister = 0; *pRegister = 0; *pRegister = 0; pRegister = (int *)0xFFFFFF90; // SDRAMC_MR *pRegister = 0x00000013; // 16-bit, Load mode register on access pRegister = (int *)0x20000040; // Address will go in mode reg. mode must be
0x020 *pRegister = 0;pRegister = (int *)0xFFFFFF90; // SDRAMC_MR *pRegister = 0x00000010; // 16-bit, normal mode on access pRegister = (int *)0x20000000; *pRegister = 0;
pRegister = (int *)0xFFFFFF94; // SDRAMC_TR *pRegister = 0x000002E0; pRegister = (int *)0x20000000; *pRegister = 0;
I've played around with the value of SDRAM_CR, the number of refreshes and the addres vor the mode register set, but no change. After this init procedure, I see refresh cycles every 15 us.
When I write the entire SDRAM with 0x0001 and then read back, all I get is
0xFFFF. When I write and immediately read the same location, I mostly get the right value back, but in about 1 out of 2000 (seems random) I get 0xFFFF instead of the right value (0x0001). And the wrong value is always 0xFFFF, nothing else.Any ideas what to try next?