Hi, I'm using LPC3250. I run the 'blinky' software on the PHYTEC-LPC3250 in the External SDRam mode and it works perfect. The Phytec board has 2 x MT48H16M16LF (SDR) SDRAM and the EXT_SDRAM.ini that come with the KEIL sample - works. I try to run this software (blinky) on another board and the only differance is that this new board has the MT46H16M16LF (DDR) SDRAM on board. I try (a lot of time) to configure the EXT_SDRAM.ini file to the new chip but I always get the same problem: The program loads and it looks that the memory address (0x80000000) holds the program code but when i run (or step) in the program the memory return to all zero (0x00) and the program stops. I'm almost sure that the problem is with the initialize of the external sdram as it should hold the uploaded program - but the (my) configuration has errors and the SDRAM fail to hold the data. If someone already use the chip (MT46H16M16LF) and has the initialize procedure ,I will be happy to get this sample to put it in the EXT_SDRAM.INI file for startup. here is (part of) the original code (that works for phytec):
SDRAM_MODE_REG = 0x80018000; // SDRAM Mode Register Address SDRAM_EXT_MODE_REG = 0x8102C000; // SDRAM Extended Mode Reg Address // Constants NORMAL_CMD = (0x0 << 7); // NORMAL Command MODE_CMD = (0x1 << 7); // MODE Command PALL_CMD = (0x2 << 7); // Precharge All Command NOP_CMD = (0x3 << 7); // NOP Command REFSH_MODE = (0x1 << 2); // Self-refresh mode // Setup EMC Controller _WDWORD(EMCControl , 0x00000001); _WDWORD(EMCConfig , 0x00000000); if (Setup & 0x04) { // Setup Dynamic Memory Interface // Initialize Dynamic Memory Controller to interface _WDWORD(SDRAMCLK_CTRL , 0x0001C000); // 64 MB of SDRAM connected on DYCS0 _WDWORD(EMCDynRP , 0x00000001); _WDWORD(EMCDynRAS , 0x00000004); _WDWORD(EMCDynSREX , 0x00000008); _WDWORD(EMCDynWR , 0x00000001); _WDWORD(EMCDynRC , 0x00000007); _WDWORD(EMCDynRFC , 0x00000008); _WDWORD(EMCDynXSR , 0x00000008); _WDWORD(EMCDynRRD , 0x00000002); _WDWORD(EMCDynMRD , 0x00000002); _WDWORD(EMCDynCDLR , 0x00000001); _WDWORD(EMCDynReadCfg , 0x00000011); _WDWORD(EMCDynRasCas0 , 0x00000302); _WDWORD(EMCDynConfig0 , 0x00005682); _WDWORD(EMCDynControl , NOP_CMD |0x03); _sleep_ (1); _WDWORD(EMCDynControl , PALL_CMD |0x03); _WDWORD(EMCDynControl , NOP_CMD |0x03); _WDWORD(EMCDynRefresh , 0x00000002); _sleep_ (1); _WDWORD(EMCDynRefresh , 0x00000032); _sleep_ (1); _WDWORD(EMCDynControl , MODE_CMD |0x03); _RDWORD(SDRAM_MODE_REG); _sleep_ (1); _RDWORD(SDRAM_EXT_MODE_REG); _WDWORD(EMCDynControl , NORMAL_CMD|0x03); _sleep_ (1); _WDWORD(EMCAHBControl0 , 0x00000001); _WDWORD(EMCAHBTimeOut0 , 0x00000064); _WDWORD(EMCAHBControl2 , 0x00000001); _WDWORD(EMCAHBTimeOut2 , 0x00000190); _WDWORD(EMCAHBControl3 , 0x00000001); _WDWORD(EMCAHBTimeOut3 , 0x00000190); _WDWORD(EMCAHBControl4 , 0x00000001); _WDWORD(EMCAHBTimeOut4 , 0x00000190); }
here is my modified code (for the new chip) I mark the changed line with //new
SDRAM_MODE_REG = 0x80018000; // SDRAM Mode Register Address SDRAM_EXT_MODE_REG = 0x8102C000; // SDRAM Extended Mode Reg Address // Constants NORMAL_CMD = (0x0 << 7); // NORMAL Command MODE_CMD = (0x1 << 7); // MODE Command PALL_CMD = (0x2 << 7); // Precharge All Command NOP_CMD = (0x3 << 7); // NOP Command REFSH_MODE = (0x1 << 2); // Self-refresh mode // Setup EMC Controller _WDWORD(EMCControl , 0x00000001); //ok _WDWORD(EMCConfig , 0x00000000); //ok if (Setup & 0x04) { // Setup Dynamic Memory Interface // Initialize Dynamic Memory Controller to interface _WDWORD(SDRAMCLK_CTRL , 0x0001C002); //ok (new) // 64 MB of SDRAM connected on DYCS0 _WDWORD(EMCDynRP , 0x00000001); //ok _WDWORD(EMCDynRAS , 0x00000004); //ok _WDWORD(EMCDynSREX , 0x00000008); //ok _WDWORD(EMCDynWR , 0x00000001); //ok _WDWORD(EMCDynRC , 0x00000007); //ok _WDWORD(EMCDynRFC , 0x00000008); //ok _WDWORD(EMCDynXSR , 0x00000008); //ok _WDWORD(EMCDynRRD , 0x00000002); //ok _WDWORD(EMCDynMRD , 0x00000002); //ok _WDWORD(EMCDynCDLR , 0x00000001); //ok _WDWORD(EMCDynReadCfg , 0x00001111); //ok (new) _WDWORD(EMCDynRasCas0 , 0x00000302); //ok _WDWORD(EMCDynConfig0 , 0x00001686); //ok (new) _WDWORD(EMCDynConfig1 , 0x00001686); //ok (new) _WDWORD(EMCDynControl , NOP_CMD |0x03); _sleep_ (1); _WDWORD(EMCDynControl , PALL_CMD |0x03); _WDWORD(EMCDynControl , NOP_CMD |0x03); _WDWORD(EMCDynRefresh , 0x00000002); _sleep_ (1); _WDWORD(EMCDynRefresh , 0x00000032); _sleep_ (1); _WDWORD(EMCDynControl , MODE_CMD |0x03); _RDWORD(SDRAM_MODE_REG); _sleep_ (1); _RDWORD(SDRAM_EXT_MODE_REG); _WDWORD(EMCDynControl , NORMAL_CMD|0x03); _sleep_ (1); _WDWORD(EMCAHBControl0 , 0x00000001); _WDWORD(EMCAHBTimeOut0 , 0x00000064); _WDWORD(EMCAHBControl2 , 0x00000001); _WDWORD(EMCAHBTimeOut2 , 0x00000190); _WDWORD(EMCAHBControl3 , 0x00000001); _WDWORD(EMCAHBTimeOut3 , 0x00000190); _WDWORD(EMCAHBControl4 , 0x00000001); _WDWORD(EMCAHBTimeOut4 , 0x00000190); }
Many thanks in advanced