32.210内存的知识

210可寻址的空间是4GB大小,内存的起始地址是20000000,前面知道2440使用的内存是SDRAM,6410使用的内存是DDR,这里210使用的是DDR2.在210的地址空间中零地址处跟6410一样也是映射镜像区,例如当选择从NandFlash启动的使用,就会把IROM的空间映射到0地址处。

内存芯片连接:

在2440和6410两款芯片中,它们的数据宽度是16bits,为了得到32bits的数据宽度,采用的是两片芯片级联的方式。而210采用的数据宽度是8bits的,要扩张成32bits,所以需要4片级联。每一片的大小是128MB,有四片总大小512MB。有一些芯片是8片的,构成1GB*32的内存芯片。

芯片手册里DMC0对应的是上图中的DRAM0,DMC1对应DRAM1.

接下来就是初始化DRAM0这512MB内存。

初始化流程:

Initialization sequence for DDR2 memory type:

1. To provide stable power for controller and memory device, the controller must assert and hold CKE to a logic low level. Then apply stable clock. Note: XDDR2SEL should be High level to hold CKE to low.

2. Set the PhyControl0.ctrl_start_point and PhyControl0.ctrl_inc bit-fields to correct value according to clock frequency. Set the PhyControl0.ctrl_dll_on bit-field to '1' to turn on the PHY DLL.

3. DQS Cleaning: Set the PhyControl1.ctrl_shiftc and PhyControl1.ctrl_offsetc bit-fields to correct value according to clock frequency and memory tAC parameters.

4. Set the PhyControl0.ctrl_start bit-field to '1'.

5. Set the ConControl. At this moment, an auto refresh counter should be off.

6. Set the MemControl. At this moment, all power down modes should be off.

7. Set the MemConfig0 register. If there are two external memory chips, set the MemConfig1 register.

8. Set the PrechConfig and PwrdnConfig registers.

9. Set the TimingAref, TimingRow, TimingData and TimingPower registers according to memory AC parameters.

10. If QoS scheme is required, set the QosControl0~15 and QosConfig0~15 registers.

11. Wait for the PhyStatus0.ctrl_locked bit-fields to change to '1'. Check whether PHY DLL is locked.

12. PHY DLL compensates the changes of delay amount caused by Process, Voltage and Temperature (PVT) variation during memory operation. Therefore, PHY DLL should not be off for reliable operation. It can be off except runs at low frequency. If off mode is used, set the PhyControl0.ctrl_force bit-field to correct value according to the PhyStatus0.ctrl_lock_value[9:2] bit-field to fix delay amount. Clear the PhyControl0.ctrl_dll_on bit-field to turn off PHY DLL.

13. Confirm whether stable clock is issued minimum 200us after power on

14. Issue a NOP command using the DirectCmd register to assert and to hold CKE to a logic high level.

15. Wait for minimum 400ns.

16. Issue a PALL command using the DirectCmd register.

17. Issue an EMRS2 command using the DirectCmd register to program the operating parameters.

18. Issue an EMRS3 command using the DirectCmd register to program the operating parameters.

19. Issue an EMRS command using the DirectCmd register to enable the memory DLLs.

20. Issue a MRS command using the DirectCmd register to reset the memory DLL.

21. Issue a PALL command using the DirectCmd register.

22. Issue two Auto Refresh commands using the DirectCmd register.

23. Issue a MRS command using the DirectCmd register to program the operating parameters without resetting the memory DLL.

24. Wait for minimum 200 clock cycles.

25. Issue an EMRS command using the DirectCmd register to program the operating parameters. If OCD calibration is not used, issue an EMRS command to set OCD Calibration Default. After that, issue an EMRS command to exit OCD Calibration Mode and to program the operating parameters.

26. If there are two external memory chips, perform steps 14~25 for chip1 memory device.

27. Set the ConControl to turn on an auto refresh counter. 28. If power down modes is required, set the MemControl registers.

先建立框架:

  1. 在原来的过程里创建一个mem.S文件:

  1. 在mem.S里声明一个全局的标号:

  1. 接着把mem.S加入到Makefile工程文件里:

4.是在start.S里加入内存初始化的标识:

5.编译一下,看看是否出错:

没有报错说明框架没问题,接下来就是mem.S的初始化代码。

1. To provide stable power for controller and memory device, the controller must assert and hold CKE to a logic low level. Then apply stable clock. Note: XDDR2SEL should be High level to hold CKE to low.

这是电源为控制器和内存设备提供稳定电压的要求,是硬件的,略过。

2. Set the PhyControl0.ctrl_start_point and PhyControl0.ctrl_inc bit-fields to correct value according to clock frequency. Set the PhyControl0.ctrl_dll_on bit-field to '1' to turn on the PHY DLL.

这里是要设置PhyControl0寄存器的ctrl_start_point位和ctrl_inc位,根据时钟频率,还有就是设置ctrl_dll_on来打开PHY DLL。

@ step 2.1

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101000

str    r1, [r0]

@ step 2.2

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101002

str    r1, [r0]

3. DQS Cleaning: Set the PhyControl1.ctrl_shiftc and PhyControl1.ctrl_offsetc bit-fields to correct value according to clock frequency and memory tAC parameters.

没有使用跳过。

4. Set the PhyControl0.ctrl_start bit-field to '1'.

@ step 4

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101003

str    r1, [r0]

5. Set the ConControl. At this moment, an auto refresh counter should be off.

@ step 5

ldr    r0, =DMC_CONCONTROL

ldr    r1, =0x0FFF1350

str    r1, [r0]

6. Set the MemControl. At this moment, all power down modes should be off.

@ step 6

ldr    r0, =DMC_MEMCONTROL

ldr    r1, =DMC0_MEMCONTROL

str    r1, [r0]

7. Set the MemConfig0 register. If there are two external memory chips, set the MemConfig1 register.

@ step 7

ldr    r0, =DMC_MEMCONFIG0

ldr    r1, =DMC0_MEMCONFIG_0

str    r1, [r0]

8. Set the PrechConfig and PwrdnConfig registers.

@ step 8

ldr    r0, =DMC_PRECHCONFIG

ldr    r1, =0xFF000000

str    r1, [r0]

9. Set the TimingAref, TimingRow, TimingData and TimingPower registers according to memory AC parameters.

#define DMC_PHYCONTROL0 0xf0000018

#define DMC_PHYCONTROL1 0xf000001c

#define DMC_CONCONTROL 0xf0000000

#define DMC_MEMCONTROL 0xf0000004

#define DMC_MEMCONFIG0 0xf0000008

#define DMC_MEMCONFIG1 0xf000000c

#define DMC_PRECHCONFIG 0xf0000014

#define DMC_TIMINGAREF     0xf0000030

#define DMC_TIMINGROW     0xf0000034

#define DMC_TIMINGDATA     0xf0000038

#define DMC_TIMINGPOWER 0xf000003c

#define DMC_PHYSTATUS 0xf0000040

#define DMC_DIRECTCMD     0xf0000010

#define DMC_PWRDNCONFIG 0xf0000028

#define DMC0_MEMCONTROL            0x00202400

#define DMC0_MEMCONFIG_0        0x20F00313

#define DMC0_MEMCONFIG_1        0x00F00313

#define DMC0_TIMINGA_REF 0x00000618

#define DMC0_TIMING_ROW 0x2B34438A

#define DMC0_TIMING_DATA 0x24240000

#define DMC0_TIMING_PWR 0x0BDC0343

.globl mem_init

mem_init:

@ step 2.1 Set the PhyControl0.ctrl_start_point and PhyControl0.ctrl_inc

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101000

str    r1, [r0]

@ step 2.2 Set the PhyControl0.ctrl_dll_on bit-field to '1' to turn on the PHY DLL.

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101002    @是在上面的基础上修改

str    r1, [r0]

@ step 4

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101003

str    r1, [r0]

@ step 5

ldr    r0, =DMC_CONCONTROL

ldr    r1, =0x0FFF1350

str    r1, [r0]

@ step 6

ldr    r0, =DMC_MEMCONTROL

ldr    r1, =DMC0_MEMCONTROL

str    r1, [r0]

@ step 7

ldr    r0, =DMC_MEMCONFIG0

ldr    r1, =DMC0_MEMCONFIG_0

str    r1, [r0]

@ step 8

ldr    r0, =DMC_PRECHCONFIG

ldr    r1, =0xFF000000

str    r1, [r0]

@ step 9.1

ldr    r0, =DMC_TIMINGAREF

ldr    r1, =DMC0_TIMINGA_REF

str    r1, [r0]

@ step 9.2

ldr    r0, =DMC_TIMINGROW

ldr    r1, =DMC0_TIMING_ROW

str    r1, [r0]

@ step 9.3

ldr    r0, =DMC_TIMINGDATA

ldr    r1, =DMC0_TIMING_DATA

str    r1, [r0]

@ step 9.4

ldr    r0, =DMC_TIMINGPOWER

ldr    r1, =DMC0_TIMING_PWR

str    r1, [r0]

@ step 11

wait_lock:

ldr    r0, =DMC_PHYSTATUS

ldr    r1, [r0]

and    r2, r1, #0x4

cmp    r2, #0x4

bne    wait_lock

@ step 14

ldr    r0, =DMC_DIRECTCMD

ldr    r1, =0x07000000

str    r1, [r0]

@ step 16

ldr    r1, =0x01000000

str    r1, [r0]

@ step 17

ldr    r1, =0x00020000

str    r1, [r0]

@ step 18

ldr    r1, =0x00030000

str    r1, [r0]

@ step 19

ldr    r1, =0x00010400

str    r1, [r0]

@ step 20

ldr    r1, =0x00000542

str    r1, [r0]

@ step 21

ldr    r1, =0x01000000

str    r1, [r0]

@ step 22.1

ldr    r1, =0x05000000

str    r1, [r0]

@ step 22.2

ldr    r1, =0x05000000

str    r1, [r0]

@ step 23

ldr    r1, =0x00000442

str    r1, [r0]

@ step 25.1

ldr    r1, =0x00010780

str    r1, [r0]

@ step 25.2

ldr    r1, =0x00010400

str    r1, [r0]

@ step 26, repeat step14~step25

ldr    r1, =0x07100000

str    r1, [r0]

ldr    r1, =0x01100000

str    r1, [r0]

ldr    r1, =0x00120000

str    r1, [r0]

ldr    r1, =0x00130000

str    r1, [r0]

ldr    r1, =0x00110400

str    r1, [r0]

ldr    r1, =0x00100542

str    r1, [r0]

ldr    r1, =0x01100000

str    r1, [r0]

ldr    r1, =0x05100000

str    r1, [r0]

ldr    r1, =0x05100000

str    r1, [r0]

ldr    r1, =0x00100442

str    r1, [r0]

ldr    r1, =0x00110780

str    r1, [r0]

ldr    r1, =0x00110400

str    r1, [r0]

@ step 27

ldr r0, =DMC_CONCONTROL

ldr    r1, =0x0FF02030

str    r1, [r0]

ldr r0, =DMC_PWRDNCONFIG

ldr    r1, =0xFFFF00FF

str    r1, [r0]

ldr r0, =DMC_CONCONTROL

ldr    r1, =0x00202400

str    r1, [r0]

mov    pc, lr

转载于:https://www.cnblogs.com/FORFISH/p/5188755.html

32.210内存的知识相关推荐

  1. 计算机内存知识txt,计算机新手必备内存实用知识.docx

    在电脑硬件中,CPU和显卡.内存均是重中之重,因此我们在选择这些核心硬件一定要慎重考虑.下面就让小编带你去看看计算机新手必备内存实用知识,希望能帮助到大家! 内存总是不够?HBase&GeoM ...

  2. 服务器内存技术知识充电

    服务器内存技术知识充电 起服务器内存,很多人可能会觉得不明所以,其实服务器内存与普通内存还是有着很多共同点的,不过它加入了一些针对高端应用而设计的功能和特性,下面我就以一问一答的方式为各位介绍一下服务 ...

  3. 【STM32H7教程】第25章 STM32H7的TCM,SRAM等五块内存基础知识

    完整教程下载地址:http://forum.armfly.com/forum.php?mod=viewthread&tid=86980  第25章       STM32H7的TCM,SRAM ...

  4. [转载]内存分配 知识,全局,局部,静态变量

    [转载]内存分配 知识,全局,局部,静态变量 预备知识-程序的内存分配 一个由C/C++编译的程序占用的内存分为以下几个部分 1.栈区(stack)- 由编译器自动分配释放 ,存放函数的参数值,局部变 ...

  5. 计算机内存知识txt,计算机内存基础知识专题

    计算机内存基础知识专题 计算机是由哪几部分组成的呢?简单的说,一个完整的计算机系统是由软件和硬件组成的.其中,硬件部分由中央处理单元(运算器和控制器).存储器和输入/输出设备构成.这次我们要谈的是存储 ...

  6. 通用计算机中使用的内存条,如何选购电脑内存条?小白装机通俗易懂的电脑内存选购知识指南...

    内存是电脑中重要的硬件之一,它是与CPU进行沟通的桥梁,无论是电脑还是手机都有内存的,手机运存相当于电脑中的内存.我们在选购电脑内存的时候,通常我们只看内存的品牌和容量以及频率,对内存其它的参数不是太 ...

  7. 内存基础知识汇总指南

    什么是内存 序论 今天,不管你的计算机有多少内存,内存总像是不太够用.不久前,个人计算机能够拥有超过1或2MB的内存还是闻所未闻的,而今天,大多数的系统需要64MB以执行基本的应用程式,且需要至少25 ...

  8. (王道408考研操作系统)第三章内存管理-第一节1:内存基础知识、程序编译运行原理

    注意:本节内容和<计算机组成原理>"存储器"那一部分内容相关性很强,组成原理是从硬件角度,操作系统是从软件角度.因此如果没有学习过这部分的同学,强烈建议先看这一部分 王 ...

  9. 内存分配知识:全局,局部,静态变量

    预备知识-程序的内存分配  一个由C/C++编译的程序占用的内存分为以下几个部分  1.栈区(stack)- 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等.其操作方式类似于数据结构中的栈. ...

最新文章

  1. 分页解决方案 —— GridView + QuickPager + QuickPager_SQL + DataAccessLibrary + 数据库
  2. JS对文本框输入字符的限制
  3. 蛮力写算法_蛮力算法解释
  4. CUDA零拷贝内存(zerocopy memory)
  5. OpenCV安装与第一个程序
  6. iis搭建php出现301,IIS服务器PHP下三种实现301重定向的方法
  7. li的鼠标移入移出事件和点击事件分别实现为当前li添加样式,删除其他li样式...
  8. 百面机器学习——什么是决策树
  9. [转载]HTML5 Audio/Video 标签,属性,方法,事件汇总
  10. lg手机历史机型_细数LG G系列旗舰手机进化史
  11. 一篇文章搞懂BIM技术的要点和前景
  12. 手机滚动截屏软件推荐
  13. 熟练掌握计算机应用,计算机应用技术专业个人技能怎么写
  14. Bounds用法参考
  15. javascript有声调的汉字注音字典(兼容各浏览器)
  16. JVM 面试 4 连炮,你能顶住么?
  17. sgfdgfadsg
  18. 反垃圾邮件系统|基于Springboot+vue 实现反垃圾邮件系统
  19. 群辉NAS+为知笔记docker定制私有云笔记
  20. 每日刷题记录 (一)

热门文章

  1. mybatis3.2.8 与 hibernate4.3.6 混用
  2. CSS Hack 和向后兼容
  3. 网页与APP中那些优美的登陆表单
  4. 谈谈Unicode编码,简要解释UCS、UTF、BMP、BOM等名词
  5. 我们工作到底为了什么?
  6. vuecli3的svgicon_vue-cli3引入svg图标全过程以及遇到的坑
  7. 源码解析 使用tomcat作为web容器时,用到的外观模式
  8. 创建Vue实例传入的options||Vue的生命周期
  9. ajax请求成功后location.href没有跳转
  10. Apache Solr入门教程