This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EMCDynamicCfg0 gets overwritten?

Hallo

Im using the LPC2478 with 8 MB external memory. Im setting up the SDRAM from within the LPC2400.s file.

Everything is OK, until a NORMAL command is issued to the SDRAM (Right after dummy read)

LDR R4, =NORMAL_CMD ; Write NORMAL Command
STR R4, [R0, #EMC_DYN_CTRL_OFS]

The last code line, overwrittes the EMCDynamicCfg0 register with a value resulting in selection of a wrong SDRAM type.
Before the call the EMCDynamicConfig0 is 0x00001280
After the line its 0x07664448 ???

The values in R4, R0 and #EMC_DYN_CTRL_OFS are just fine.

Why does that code write to my EMCDynamicConfig0 register? It schould write to the EMCDynamicControl register instead. But it writes to both with a corrupted value?

/Thomas

Parents
  • Hallo

    Do you mean the assembly of the compiled C source??

    I have send the assembly code for the builded source:

    64: // Wait 0 65: //wait 128 ABH clock cycles
    0x0000054C E3A01D4A MOV R1,#0x00001280
    0x00000550 E5801100 STR R1,[R0,#0x0100] 66: for(i=0; i<0x100; i++); 67: //Send command: NOP
    0x00000554 E3A01000 MOV R1,#0x00000000
    0x00000558 E3510C01 CMP R1,#0x00000100
    0x0000055C 2A000001 BCS 0x00000568
    0x00000560 E2811001 ADD R1,R1,#0x00000001
    0x00000564 EAFFFFFB B 0x00000558 68: EMC_DYN_CTRL = 0x00000183; 69: 70: // Wait 1 71: //wait 128 ABH clock cycles
    0x00000568 E59F108C LDR R1,[PC,#0x008C]
    0x0000056C E5801020 STR R1,[R0,#0x0020] 72: for(i=0; i<0x100; i++); 73: //Send command: PRECHARGE-ALL, shortest possible refresh period
    0x00000570 E3A01000 MOV R1,#0x00000000
    0x00000574 E3510C01 CMP R1,#0x00000100
    0x00000578 2A000001 BCS 0x00000584
    0x0000057C E2811001 ADD R1,R1,#0x00000001
    0x00000580 EAFFFFFB B 0x00000574 74: EMC_DYN_CTRL = 0x00000103;
    0x00000584 E59F1074 LDR R1,[PC,#0x0074]
    0x00000588 E5801020 STR R1,[R0,#0x0020]

    /Thomas

Reply
  • Hallo

    Do you mean the assembly of the compiled C source??

    I have send the assembly code for the builded source:

    64: // Wait 0 65: //wait 128 ABH clock cycles
    0x0000054C E3A01D4A MOV R1,#0x00001280
    0x00000550 E5801100 STR R1,[R0,#0x0100] 66: for(i=0; i<0x100; i++); 67: //Send command: NOP
    0x00000554 E3A01000 MOV R1,#0x00000000
    0x00000558 E3510C01 CMP R1,#0x00000100
    0x0000055C 2A000001 BCS 0x00000568
    0x00000560 E2811001 ADD R1,R1,#0x00000001
    0x00000564 EAFFFFFB B 0x00000558 68: EMC_DYN_CTRL = 0x00000183; 69: 70: // Wait 1 71: //wait 128 ABH clock cycles
    0x00000568 E59F108C LDR R1,[PC,#0x008C]
    0x0000056C E5801020 STR R1,[R0,#0x0020] 72: for(i=0; i<0x100; i++); 73: //Send command: PRECHARGE-ALL, shortest possible refresh period
    0x00000570 E3A01000 MOV R1,#0x00000000
    0x00000574 E3510C01 CMP R1,#0x00000100
    0x00000578 2A000001 BCS 0x00000584
    0x0000057C E2811001 ADD R1,R1,#0x00000001
    0x00000580 EAFFFFFB B 0x00000574 74: EMC_DYN_CTRL = 0x00000103;
    0x00000584 E59F1074 LDR R1,[PC,#0x0074]
    0x00000588 E5801020 STR R1,[R0,#0x0020]

    /Thomas

Children