24-58
MC9328MX1 Reference Manual
MOTOROLA
SDRAM Memory Controller
Code Example 24-2. init_sdram
init_sdram:
ldr
r2,CSD_REGS
// base address of registers
ldr
r3,PRE_ALL_CMD
st
r3,(0,r2)
// put array 0 in precharge command mode
st
r3,(4,r2)
// put array 1 in precharge command mode
ldr
r4,SDRAM_ARRAY_0
// get address of first array
ldr
r5,SDRAM_ARRAY_1
// get address of second array
ld
r3,(0,r4)
// precharge array 0
ld
r3,(0,r5)
// precharge array 1
ldr
r3,AUTO_REF_CMD
st
r3,(0,r2)
// put array 0 in auto-refresh mode
st
r3,(4,r2)
// put array 1 in auto-refresh mode
movi
r6,7
// load loop counter
L1
ld
r3,(0,r4)
// run auto-refresh cycle to array 0
ld
r3,(0,r5)
// run auto-refresh cycle to array 1
decgt
r6
bt
L1
// 8 refresh cycles complete?
ldr
r3,SET_MODE_REG_CMD
st
r3,(0,r2)
// setup CSD0 for mode register write
st
r3,(4,r2)
// setup CSD1 for mode register write
ldr
r3,MODE_REG_VAL0
// array 0 mode register value
ld
r3,(0,r3)
// New mode register value on address bus
ldr
r3,MODE_REG_VAL1
// array 1 mode register value
ld
r3,(0,r3)
// Write CSD1 mode register
ldr
r3,NORMAL_MODE
st
r3,(0,r2)
// setup CSD0 for normal operation
st
r3,(4,r2)
// setup CSD1 for normal operation
CSD_REGS
.long
0x00221000
SDRAM_ARRAY_0:
.long
0x08000000
SDRAM ARRAY_1:
.long
0x0c000000
PRE_ALL_CMD
.long
0xXXXXXXXX
AUTO_REF_CMD
.long
0xXXXXXXXX
SET_MODE_REG_CMD.long
0xXXXXXXXX
MODE_REG_VAL0
.long
0xXXXXXXXX
MODE_REG_VAL1
.long
0xXXXXXXXX
NORMAL_MODE
.long
0xXXXXXXXX
24.8.4 Mode Register Programming
This section describes how to program the SDRAM mode register using the MC9328MX1 external
address bus. The mode register is used to set the SDRAM operating characteristics including CAS latency,
burst length, burst mode, and write data length. The settings depend on system characteristics including the
operating frequency, memory device type, burst buffer/cache line length, and bus width. Operating
characteristics vary by device type, so the data sheet must be consulted to determine the actual value to be
written.
Table 24-33 through Table 24-38 provide examples of the SDRAM memory mode register configuration
for different SDRAM memory densities. These tables depict which mode register bit is connected to the
SDRAM memory address pin. Because the mode register is written via the MC9328MX1 external address
bus, and the SDRAM data sheet specifies the SDRAM addresses on which to place the data, the next step
is to then determine the address translation from the MC9328MX1 internal address bus to the
MC9328MX1 external address pins. Table 24-39 on page 24-60 provides an example of which mode bits
are mapped to which internal address bit for each of the given memory densities.
Table 24-33. 4M x 16 Memory Configuration
SDRAM Address
BA1
BA0
A11
A10
A9
A8
A7
A6
A5
A4
A3
A2
A1
A0
Mode Register Bit
M13
M12
M11
M10
M9
M8
M7
M6
M5
M4
M3
M2
M1
M0
Content
Reserved
WB
Reserved
CAS latency
BT
Burst length
Summary of Contents for DragonBall MC9328MX1
Page 68: ...1 12 MC9328MX1 Reference Manual MOTOROLA Introduction ...
Page 86: ...2 18 MC9328MX1 Reference Manual MOTOROLA Signal Descriptions and Pin Assignments ...
Page 116: ...3 30 MC9328MX1 Reference Manual MOTOROLA Memory Map ...
Page 126: ...4 10 MC9328MX1 Reference Manual MOTOROLA ARM920T Processor ...
Page 160: ...8 8 MC9328MX1 Reference Manual MOTOROLA System Control ...
Page 272: ...13 32 MC9328MX1 Reference Manual MOTOROLA DMA Controller ...
Page 281: ...Programming Model MOTOROLA Watchdog Timer Module 14 9 ...
Page 282: ...14 10 MC9328MX1 Reference Manual MOTOROLA Watchdog Timer Module ...
Page 300: ...15 18 MC9328MX1 Reference Manual MOTOROLA Analog Signal Processor ASP ...
Page 438: ...18 16 MC9328MX1 Reference Manual MOTOROLA Serial Peripheral Interface Modules SPI 1 and SPI 2 ...
Page 478: ...19 40 MC9328MX1 Reference Manual MOTOROLA LCD Controller ...
Page 574: ...21 32 MC9328MX1 Reference Manual MOTOROLA Memory Stick Host Controller MSHC Module ...
Page 598: ...23 16 MC9328MX1 Reference Manual MOTOROLA Real Time Clock RTC ...
Page 670: ...24 72 MC9328MX1 Reference Manual MOTOROLA SDRAM Memory Controller ...
Page 726: ...25 56 MC9328MX1 Reference Manual MOTOROLA SmartCard Interface Module SIM ...
Page 736: ...26 10 MC9328MX1 Reference Manual MOTOROLA General Purpose Timers ...
Page 854: ...29 18 MC9328MX1 Reference Manual MOTOROLA I2C Module ...
Page 900: ...30 46 MC9328MX1 Reference Manual MOTOROLA Synchronous Serial Interface SSI ...
Page 942: ...32 26 MC9328MX1 Reference Manual MOTOROLA GPIO Module and I O Multiplexer IOMUX ...