EmbDev.net

Forum: µC & Digital Electronics SDRAM with Coldfire MCF5307


von Frank B. (frank13)


Rate this post
useful
not useful
Hi Everyone!


I have a problem with the SDRAM on my Testboard.

I use the 5307 with 128kB external Flash (address: 0x0) and want to 
connect an MT48LC2M32B2 – 512K x 32 x 4 banks SDRAM chip. I use the 
following init so it should be at 0xa0000000.


static void init_dram_controller (void)
{
int     i;
MCF5307_DRAMC_DCR = MCF5307_DRAMC_DCR_SO       |
                    MCF5307_DRAMC_DCR_RTIM_3   |
                    MCF5307_DRAMC_DCR_RC(0x27);
MCF5307_DRAMC_DACR0 = (0x2800 << 18)              |
                      MCF5307_DRAMC_DACR_CASL_1   |
                      MCF5307_DRAMC_DACR_CBM(0x3) |
                      MCF5307_DRAMC_DACR_PS_32    |
                      MCF5307_DRAMC_DACR_PM_OFF;
MCF5307_DRAMC_DMR0 = MCF5307_DRAMC_DCMR_MASK_8M |
                     MCF5307_DRAMC_DCMR_V;
MCF5307_DRAMC_DACR0 |= MCF5307_DRAMC_DACR_IP;
* (vuint32 *) 0xa0000000 = 0xcafebabe;
for (i = 0; i < 5; i++)
        asm ("nop");
MCF5307_DRAMC_DACR0 |= MCF5307_DRAMC_DACR_RE;
for (i = 0; i < 2000; i++)
        asm ("nop");
MCF5307_DRAMC_DACR0 |= MCF5307_DRAMC_DACR_IMRS;
* (vuint32 *) 0xa0000800 = 0xcafebabe;
MCF5307_DRAMC_DMR1 = MCF5307_DRAMC_DCMR_MASK_512K;
MCF5307_DRAMC_DACR1 = MCF5307_DRAMC_DACR_CAS_1  |
                      MCF5307_DRAMC_DACR_RP_1   |
                      MCF5307_DRAMC_DACR_RCD_1  |
                      MCF5307_DRAMC_DACR_PS_32  |
                      MCF5307_DRAMC_DACR_PM_OFF;

}

Now I try to read / write from the SDRAM but I always get corrupt data. 
Where is my fault? Have I forgotton some code in the init?


read:                  t=(*((vuint32 *) 0xa0000010));
write:                 (*((vuint32 *) 0xa0000010))=0x12345678;

Best regards

Frank

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.