SDRAM with Coldfire MCF5307

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

A question of your own? This thread is over 15 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

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.