SDRAM initialization and testing
Here's an example for SDRAM initialization and testing
- mov r0, #PBASE_SDRAM
- ldr r1, =PBASE_SDRAMC
- @ 1
- ldr r2, =0x85227279
- str r2, [r1, #SDRAMC_CR]
- @ 3
- mov r2, #0
- str r2, [r1, #SDRAMC_MDR]
- @ 4
- mov r2, #0x4f00
- 0:
- subs r2, r2, #1
- bne 0b
- @ 5
- mov r2, #2
- str r2, [r1, #SDRAMC_MR]
- str r2, [r0]
- @ 6
- mov r2, #4
- str r2, [r1, #SDRAMC_MR]
- 0:
- str r2, [r0]
- add r2, r2, #1
- cmp r2, #12
- bls 0b
- @ 7
- mov r2, #3
- str r2, [r1, #SDRAMC_MR]
- str r2, [r0]
- @ 9
- mov r2, #0
- str r2, [r1, #SDRAMC_MR]
- str r2, [r0]
- @ 10
- ldr r2, =1562
- str r2, [r1, #SDRAMC_TR]
复制代码and SDRAM testing
- ldr r1, [r0]
- mvn r2, r1
- mov r1, r2
- str r2, [r0]
- ldr r2, [r0]
- cmp r1, r2
- bne Hang
- @ fully functional now :)
- mov r0, #0
- mov r1, #(1 << 14)
- bl LedOn
- Hang:
- b Hang
复制代码
TODO:
1. Tune CR & TR parameter
2. Design SDRAM benchmark program
[ 本帖最后由 conke 于 2009-9-27 01:11 编辑 ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是我初始化内存的代码,但是测试好像读写不了内存
*************************************
@InitMem:
ldr r0, =AT91SAM926X_PA_MATRIX
ldr r1, =((1 << 16) | 2)
str r1, [r0, #MATRIX_EBI0CSA]
ldr r0, =AT91SAM926X_PA_PIOD
ldr r1, =0xffff0000
str r1, [r0, #PIO_ASR]
ldr r0, =AT91SAM926X_PA_SDRAMC
ldr r1, =0x85227279
str r1, [r0, #SDRAMC_CR]
mov r1, #0
str r1, [r0, #SDRAMC_MDR]
@delay 200 * 1000 ns = 40000 pck
mov r2, #0x4f00
loop5:
sub r2, r2, #1
cmp r2, #1
bne loop5
mov r1, #1
str r1, [r0, #SDRAMC_MR]
ldr r3, =SDRAM_BASE
str r1, [r3]
mov r1, #2
str r1, [r0, #SDRAMC_MR]
str r1, [r3]
mov r2, #8
loop6:
mov r1, #4
str r1, [r0, #SDRAMC_MR]
str r1, [r3]
sub r2, r2, #1
bge loop6
mov r1, #3
str r1, [r0, #SDRAMC_MR]
str r1, [r3]
mov r1, #0
str r1, [r0, #SDRAMC_MR]
str r1, [r3]
ldr r1, =1562
str r1, [r0, #SDRAMC_TR]
@test the mem
mov r1, #3
str r1, [r3]
ldr r2, [r3]
cmp r2, r1
bne hang
OnLed:
ldr r0, =AT91SAM926X_PA_PIOC
@ ds1 & pc29
mov r1, #0x20000000
str r1, [r0,#PIO_PER]
str r1, [r0,#PIO_OER]
str r1, [r0,#PIO_CODR]
hang:
b hang
问题已经解决,PIOD的16到31端口做为内存的数据输出端口,已经设置为A模式,但是没有设置相关端口的PIO_PDR寄存器,导致了错误,现在已经修改,接下来我会规范一下代码。
[ 本帖最后由 voidjackjiang 于 2009-9-27 15:41 编辑 ]