SDRAM with Coldfire MCF5307

OP #2132580
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

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.