EmbDev.net

Forum: µC & Digital Electronics SDRAM with Coldfire MCF5307


Author: Frank Bußmann (frank13)
Posted on:

Rate this post
0 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

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.