当前位置:   article > 正文

LPDDR5协议解析 ZQ_lpddr5引脚定义

lpddr5引脚定义

简单来说:ZQ是一个连接在VDDQ和DRAM ZQ pin上的一个精确电阻,阻值为240Ω。ZQ一般是在PCB板上,因此基本上不随着外界温度和电压的变化而变化。但DRAM内部用到的各种电阻,比如ODT等是会随着温度和电压而漂移的,ZQ training/calibration 就是为了解决这种漂移,即通过一个精准的,不跟随外界环境变化的已知阻值的电阻,来校准内部的会随VT变化的电阻,使得内部的电阻能回到漂移之前的阻值范围。

LPDDR5中的ZQ calibration

4.2.1 ZQ Calibration
Two ZQ calibration modes are supported—Background Calibration or Command-Based Calibration. In Background Calibration mode, calibration of the output driver and CA/DQ ODT impedance across process, temperature, and voltage occurs in the background of device operation and is designed to eliminate any need for coordination among channels (that is, it allows for channel independence) within a single package. Systems may also select Command-Based Calibration mode, which operates in a fashion similar to LPDDR4 devices. Command-Based Calibration mode is selected by setting MR28 OP[5]=1B. ZQ re-calibration may be required as the LPDDR5 SDRAM voltage and/or temperature changes due to changes in the system environment. ZQ calibration can only be performed when the VDDQ voltage is set
to nominal 0.5v DC or above (i.e., when DVFSQ is not active). In Background Calibration mode, the calibration shall be halted by the memory controller setting ZQ Stop when VDDQ is set to a nominal DC level below 0.5v or when VDDQ is being slewed between levels (i.e., when DVFSQ is active). In Command-Based mode, ZQCal Start commands are illegal when DVFSQ is active unless ZQ Stop is set.
See 4.2.1.2 for more information.
Changing CA ODT values (MR11-OP[6:4]) and/or DQ ODT values (MR11-OP[2:0]) will not alter the existing recalibration scheme, therefore there is no need for immediate recalibration.

解读:在LPDDR5中,用户可以选择两张ZQC的方式,一种是background ZQ,一种是command-based ZQ。

background ZQ

即DRAM自己进行周期性的ZQC,得到合适的driver/ODT的电阻值,而不用显式的发送cal命令,而用户只需要在合适的时间发送ZQ latch命令,帮助DRAM将周期性的ZQC得到合适的电阻值更新到driver/ODT上就可以。为什么不能更加自主化,自己ZQC出的值自己ZQL?因为ZQL涉及到阻值的变化(因为锁存后,更新的阻值正式生效),如果正在进行读写,突然改变阻值会使得读写数据不准确,而颗粒本身是不知道什么时候会发读写,也没法将正在路上的读写暂停,所以只能在用户没有读写的时候发送ZQ latch命令更新阻值。

command-based ZQ

需要显式的发送ZQC命令,如果不发送命令DRAM不会做电阻的校准,用户可以自由的选择在需要的时候进行ZQC命令的发送,在等待一定时间后保证ZQC的结束,再发送ZQL来发送更新电阻值。

由于ZQ电阻(精确240Ω)是接在VDDQ和ZQ pin之间的,因此当进行ZQC的时候对VDDQ有要求,VDDQ必须≥0.5V,当因为功耗的需求需要进行DVFSQ时,ZQ需要被暂停。暂停ZQ是通过一个MRW来完成的,即MR28 OP[1]。无论是background ZQ还是command-based ZQ, 在VDDQ<0.5V的时候都要通过MRW来stop ZQ。

4.2.1.1 Calibration During Powerup and Initialization
ZQ calibration is automatically performed by all LPDDR5 die during the initialization/powerup sequence
before Td, as shown in Figure 13. A ZQCal Latch command shall be issued to all LPDDR5 die on or after
Tg regardless of the state of ZQUF. ZQ Calibration mode selection may be changed any time after Tf.

解读:P28图中,Tg时刻有一个latch命令,那说明之前颗粒已经做过ZQC了,该ZQC是在解复位之后自动做的,在Td时刻(tINIT3, CS拉高)之前已经完成该次ZQC,用户只需要在Tg时刻发送一个ZQL即可保证DRAM阻值正常了,可以进行其他的training了。在Tf之后就可以通过MRW来在background和command-based的ZQC之间的来回切换

Background ZQ

P163 Table120 - MR28 寄存器信息

background ZQC 是通过MR28 OP[5]来选择的,当选择为0(默认)即为background ZQC,当选择为background ZQC后还需要选calibration interval,因为DRAM是自动做ZQC,多久做一次需要人为设定,通过MR28 OP[3:2]可以选择ZQ interval(对于command-based不生效,因为ZQC完全是由用户通过命令发送的)。

Pull-down/ODT calibration is controlled by each DRAM die using an external ZQ resistor connected between VDDQ and a package ball or pin (ZQ resources). These ZQ resources may be shared among a number of DRAM die up to a maximum of NZQ. Calibration will be automatically performed as part of power-up/initialization and after RESET_n assertion. Subsequent re-calibration will be kept up to date by the DRAM. Self-arbitration by the DRAM insures that up to NZQ die within a package can share a common external ZQ resistor and avoid conflicts. Noise immunity will not be compromised when sharing the external ZQ calibration resistor.

解读:刚刚介绍了,每个DRAM颗粒都需要一个ZQ精准电阻,有的时候DRAM厂商给到用户的是一个封装好的DRAM Package,在package中可能只会有一个精准电阻,而被多个DRAM颗粒公用。在LPDDR5协议中,share ZQ是被允许的,即在多个DRAM中已经进行了内部的仲裁,每个DRAM都有机会独占ZQ来进行各自的ZQC,仲裁策略是DRAM厂商保证的,用户不感知。

When automatic pull-down/ODT calibration is complete, pull-up/Voh calibration will start automatically. At the completion of pull-down/ODT and pull-up/Voh calibration, MR4 OP[5] bit (ZQUF) will be set if the new calibration codes do not match the currently latched codes. An MRR of this bit will notify the system that new calibration results are available and that a ZQCal Latch command (following ZQCal Latch timing constraints) should be issued to ensure accurate calibration of Pull-down, ODT and Voh is consistently maintained. Setting of ZQUF is unique to each die regardless of configuration or sharing of the ZQ pin or pins. Alternatively, the memory controller may choose not to monitor ZQUF and periodically issue ZQCal Latch commands.

解读:由于background ZQC是颗粒按照ZQ interval 定期做的,因此什么时候发送ZQL是可以推算出来的,即每间隔ZQ interval发送一次ZQL,即可latch到每次ZQC的值,更新到DRAM的内部电阻中。但这样做对controller不是特别友好,因为controller需要内部设置一个计数器来统计ZQ interval,并且有的时候此次的ZQC的值和上次是一样的(温度变化不大),其实没有必要再latch一次。为了解决这个问题,DRAM有一个MR,即MR4 OP[5],用来表示ZQC的值和上次不一样,需要ZQL来更新。只需要定期读这个flag,每当该flag为1时再发送ZQL即可。每次ZQL会将flag清零,进行ZQL的时候需要保证没有DQ的动作。

见P34 Figure14 Background ZQ Calibration Timing

Setting the MR28 OP[1]=ZQ Stop will halt all background calibration activity. Re-setting MR28 OP[1] to zero will immediately start a calibration sequence, where all DRAM die sharing the ZQ resource will recalibrate in a serial fashion. This enables rapid recalibration when exiting from DVFSQ-active mode where recalibration was not possible.

解读:当VDDQ进行DVFSQ或者下电的时候,ZQ必须stop,即通过MR28 OP[1]写1来实现,当VDDQ回到0.5V时,需要将MR28 OP[1]写0来重启ZQ,这个时候DRAM会自动做一次ZQC(只有background ZQC会自动做,command-based ZQC不会),可以等待一段时间后发送ZQL。即可latch到此次的ZQC的阻值。

To guarantee recalibration of all die sharing the ZQ resource within tZQCAL, the MR28 OP[1] ZQ Stop bit shall be reset for all Target die sharing the ZQ resource either before, or no later than 100ns after, the MR28 OP[1] ZQ Stop bit is reset on the ZQ Initiator die.

当MR28 OP[1]写0来重启ZQ后,DRAM会进行一次自动的ZQC。但是对于share-ZQ的package来说,ZQC是需要DRAM按顺序串行进行的,协议对于ZQ stop解除的时间顺序是有要求的,即initiator die应该晚于所有non-initiator(target) die来重启ZQ,因为initiator是ZQC的发起方,如果有initiator已经发起了ZQC,但有的non-initiator还在ZQ stop,那该non-initiator就会skip此次ZQC。协议允许non-initiator稍稍晚于initiator一些,只有100ns的margin。

command-based ZQC

command-based ZQ需要发送ZQCal命令来重启一次ZQC。对于share-ZQ的package,command-based ZQ之前需要先确定哪个DRAM是ZQ initiator,initiator是颗粒厂商指定的,写在了只读寄存器MR4 OP[6]。只有对initiator die的ZQC命令才有效。而一旦initiator 收到了ZQC,DRAM package 通过内部的仲裁逻辑保证内部的所有die都会进行一次按顺序串行的ZQC。如果不对initiator发送ZQC命令,而对non-initiator发送,那命令是无效的,不会对DRAM进行ZQC。

When the ZQ Initiator die is placed in powerdown or deep sleep mode, ZQCal Start commands will be ignored and re-calibration will not occur for all die sharing the ZQ resources. All die will be recalibrated only when the ZQ Initiator die exits powerdown or deep sleep mode and receives a subsequent ZQCal Start command.

When the ZQ Initiator die remains in an active mode and receives a valid ZQCal Start command, any Target die sharing ZQ resources that are in powerdown or deep sleep mode will also recalibrate normally. Systems where DRAM die sharing ZQ resources can operate in a mixed fashion (some die operating, some in powerdown or deep sleep mode) should note the ZQ Initiator die designation when determining configuration if recalibration will be required in mixed mode.

解读:当initiator处于PD时,向 initiator发送ZQC,不会有DRAM进行ZQC。当initiator不处于PD时,向initiator发送ZQC,所有的DRAM都会按顺序串行进行一次ZQC,即使有些DRAM处于PD状态。

In Command-based calibration mode, following a ZQCal Start command a ZQCal Latch command should be issued to each die after tZQCAL4, tZQCAL8 or tZQCAL16 has been met. tZQCAL4 applies to LPDDR5 DRAM die where the ZQ resource is shared among four or fewer DRAM die. tZQCAL8 applies to LPDDR5 DRAM die where the ZQ resource is shared among four and up to eight DRAM die. tZQCAL16 applies to LPDDR5 DRAM die where the ZQ resource is shared among more than eight DRAM die, up to the maximum of sixteen (NZQ).

解读:command-based ZQ需要显式发送ZQC命令,那么什么时候该去latch结果?在command-based ZQC中,MR4 OP[5]是失效的,没法通过flag来获取ZQ的值是否需要更新。所以只能等待一个固定的时间后,等待ZQC结束,然后发送ZQL来更新电阻值。等待的固定时间称之为tZQCALX,X为4,8或16,具体等待多久需要看有几个DRAM share一个ZQ,当DRAM数量≤4的时候,等待tZQCAL4即可,此时所有的DRAM都完成了ZQC,可以依次发送ZQL来更新电阻值了。可以想象,当share ZQ 的DRAM变多时,tZQCALX肯定会变大,因此tZQCAL16>tZQCAL8>tZQCAL4,如Table 24所示

The ZQCal Latch command will load the most recent calibration results to the LPDDR5 output driver and ODT devices. In cases where the correct tZQCAL4, tZQCAL8, or tZQCAL16 delay time is not met, the LPDDR5 DRAM may latch a previous valid calibration result but in no case shall latch an invalid result. As in background calibration mode, a ZQCal Latch command may be issued anytime outside of powerdown when there are no DQ operations pending or in progress. The value of ZQUF is undefined when Command-Based Calibration mode has been selected.

解读:当ZQC to ZQL的时间不满足对于的tZQCALX时,由于此次的ZQC还没做完就发送latch动作,那只会latch到上次的ZQC k出的电阻值。

Changing between Calibration Modes

ZQC的mode 是允许在background和command-based间进行切换的,只要DRAM没有处于PD。

ZQ Stop

ZQ stop只要以下几种情况会用到:

1.VDDQ下电:先发送ZQ stop,再将DRAM的VDDQ关闭。

2.DVFSQ:当VDDQ<0.5V时,或者正在做VDDQ变化的时候,需要先发送ZQ stop,在进行DVFSQ。

3.devices share ZQ:这个不同于package间share ZQ,package间share ZQ不需要发送ZQ stop,因为vendor会保证package内部各个DRAM分时复用ZQ。当ZQ share给另一个device,比如另一颗DRAM package,或者share给DDR PHY使用时,需要stop当前package内部DRAM的ZQC。

ZQ RESET

Setting the ZQ Reset MR bit resets the output impedance calibration to a default accuracy of ±30% across process, voltage, and temperature. The ZQ Reset command is executed by writing MR28-OP[0] = 1b. The ZQ Reset command will also reset the ZQ Stop MR28 OP[1] and ZQUF MR4 OP[5] bits to 0. ZQ Reset will not change the state of the ZQ Mode or ZQ Interval MR bits MR28 OP[5] or OP[3:2]. If CA ODT is enabled, the CA bus shall maintain a deselect state during tZQRESET to allow CA ODT calibration settings to be updated. In any case, operations that initiate DQ operations are always disallowed during tZQRESET. The ZQ Reset MR bit shall be reset to 0b by the DRAM after tZQRESET. To reset the ODT and output impedance in a multi-die package, the ZQ Reset function shall be issued to all die regardless of ZQ Initiator or ZQ Target designation.

解读:ZQ reset对于background ZQC和command-based ZQC其实都不太常见,除非系统需要重启,否则很少会直接ZQ reset。reset ZQ 会丢失当前ZQC 出的电阻值,reset到一个初始的code。ZQ reset是通过MR 28[0]写1来实现的,会将ZQ Stop MR28 OP[1](ZQ Stop)和ZQUF MR4 OP[5](ZQC Flag)都置为默认值为0。但是不会reset ZQ mode(MR28 OP[5])和ZQ interval(MR28 OP[3:2])。ZQ reset需要保证没有DQ/CA的动作,且reset动作发生后,DRAM会在tZQRESET后将reset释放。对于share-ZQ的package,里面所有的DRAM需要一起执行ZQ Reset。

附:关于ZQ的其他理解

从 DRAM 内部的视角来看,每个 DQ 管脚之后的电路都有多个并联的 240 欧姆电阻组成。(译注:具体地说不上来,但这些电阻用于提高信号完整性)由于颗粒制造时, CMOS 工艺本身的限制,这些电阻不可能是精确的 240 欧姆。此外,阻值还会随着温度和电压的改变而改变。所以必须校准至接近 240 欧姆,用于提高信号完整性。

为了能够对这些电阻阻值进行精确校准,每个 DRAM 颗粒具有:

  1. 专用的 DQ 校准模块
  2. 一个 ZQ 管脚连接至外部电阻,该电阻阻值为精确的 240 欧姆

这个外部电阻因为其精确而且不会随温度变化而变化的阻值,被用于参考阻值。在初始化过程中,ZQCL 命令发出后,DQ 校准模块对每个 DQ 管脚连接的电阻进行校准。

DQ 电路中的 240 欧姆电阻是 Poly Silicon Resistor 类型的,通常来说,它们的阻值会略大于 240 欧姆。因此,在 DQ 电阻上并联了很多 PMOS 管,当这些管子开启时,通过并联电阻降低 DQ 电阻的阻值,以接近 240 欧姆。

连接至 DQ 校准控制模块的电路包括一个由两个电阻组成的分压电路,其中一个是上面提到的可调阻值的 poly 电阻,而另一个则是精准的 240 欧姆电阻。当 ZQCL 命令发出后,DQ 校准控制模块使能,并通过其内部逻辑控制 VOH[0:4] 信号调整 poly 电阻阻值,直到分压电路的电压达到 VDDQ/2,即两者均为 240 欧姆。此时 ZQ 校准结束,并保存此时的 VOH 值,复制到每个 DQ 管脚的电路。

那么问题来了,为什么不在每个 DRAM 出厂时就将阻值调整至 240 欧姆呢?而是在每次使用之前(初始化)调整呢?

这是因为并联的电阻网络允许用户在不同的使用条件下对电阻进行调整,为读操作调整驱动强度,为写操作调整端接电阻值。此外,不同 PCB 具有不同的阻抗,可调整的电阻网络可针对每个 PCB 单独调整阻值,以提高信号完整性,最大化信号眼图,允许 DRAM 工作在更高的频率下。

信号驱动强度可以通过 mode register MR1[2:1] 控制。端接电阻可以通过 MR1/2/5 中的 RTT_NOM, RTT_WR & RTT_PARK 进行调节。

ZQ Calibration 作用

DRAM ZQ Calibration 校正因为外部环境变化而变化的片上电阻值,Ron 和 ODT,分别是发送驱动逻辑的输出阻抗和接收逻辑的终结电阻值,以保证传输信号的质量。

Ron 和 ODT 数值

ODT 是 On-Die-Termination 片上终结电阻的缩写,是 DRAM 接收电路中匹配传输线特征的终端电阻。终结电阻的作用是吸收信号线上的反射和干扰。笔者理解 ODT 为 DRAM 的输入阻抗。

Ron 是 DRAM 输出驱动逻辑的内部电阻,笔者理解相当于 DRAM 的输出阻抗,下图是协议第九章给出的 Ron 功能示意图。

我们知道 DRAM 和控制器之间是一个点到点的传输系统,因此如果 DRAM 的输入输出阻抗与控制器端以及传输线并不互相匹配,那么信号传输的质量会下降。因此,Ron 和 ODT 数值选取的原则之一是与传输系统匹配,系统主要包括对端控制器的输入输出阻抗,以及两者之间的传输线。

设置 Ron 和 ODT

DRAM 的 Ron 和 ODT 集成在 DRAM 内部,并且他们的数值是可通过 MRx 模式寄存器编程的。有几个固定档位可供选择,以 RZQ 的若干份之一为单位。比如 DDR4 的输出阻抗,可以为 RZQ/5 或者 RZQ/7 。

RZQ 是一个 PCB 上阻值固定的分立电阻元件,一般选取 240 欧这个阻值。RZQ 一端连接到 DRAM 的 ZQ pin,另一端接地。RZQ 对电阻是有要求的,首先阻值需要足够高的精度,另外阻值随温度变化的程度尽可能小。

在设计 DRAM 系统时,会根据传输线的情况,计算或者仿真出一组信号完整性最佳的控制器输出输出阻抗与 DRAM 输入输出阻抗。在 DRAM 初始化时,通过 MRx 模式寄存器配置选取的这个最佳值。DRAM 调节内部输入输出阻抗值,将分压后的电压与 RZQ 上电压进行比较,如果二者相等,那么 DRAM 就调节出了一个 RZQ 阻值若干份之一的内部电阻阻值。

举个例子,信号完整性仿真得到最佳的 DRAM 输出阻抗值为 50 欧,RZQ 为 240 欧,因此 DRAM 支持 34 欧(RZQ/7)和 48 欧(RZQ/5)两种配置,选取更接近的 RZQ/5 配置。 DRAM 在一定范围内调节电阻值(调节并联的电阻数量),发现并联 N 个电阻时,输出电阻上的电压的 1/5 分压与 RZQ 上的电压相等,即选择并联 N 个电阻作为输出电阻。

校正 Ron 和 ODT

DRAM 初始化后,我们设置了预期的 DRAM 输入输出阻抗值,系统工作一切正常,但是好景不长。系统的外部环境条件逐渐变化,最主要的是 V 和 T 的变化,分别是 Voltage 电压和 Temperature 温度。比如系统开始工作后,热量逐渐累积,DRAM 结温逐渐上升。或者系统负载加大,电源供应能力不足,电压出现了下降。

因为 Ron 和 ODT 是集成在 DRAM 芯片内的电阻,他们也会随 V 和 T 变化而变化,阻值可能发生较大的变化,此时传输系统的阻抗逐渐进入不匹配区间,信号质量下降,系统就可能出现信号收发错误的问题。

为了防止出现上述这种糟糕的情况,我们需要在 V 和 T 发生急剧变化之后,重新校正 Ron 和 ODT 的阻值。ZQ Calibration 需要一个几乎不随 V 和 T 变化的电阻作为参考来调节变化的电阻,那么哪里去找一个几乎不变的阻值呢?

这个电阻就是前文提到的 RZQ——PCB 上的分立高精度电阻。因为 RZQ 在 DRAM 芯片外部,所以 RZQ 阻值几乎不会被 DRAM 芯片上的温度和电压变化所影响。虽然,整个系统的温度,包括芯片和 PCB 的温度都会上升,但是 PCB 上的温度一般比芯片内部温度低得多,并且通过选取特定的,阻值对温度不敏感的电阻能够尽量克服系统的温度变化。

在新的温度和电压下,重复 DRAM 初始化时的电阻 Calibration 流程,DRAM 就可以把阻值调节回预期的数值。

接着上文举的例子,DRAM 此时发现并联 N 个电阻时,电压值已偏离 RZQ 上的电压值,重新调节发现选取 M 个电阻并联时,输出电阻上的电压的 1/5 分压与 RZQ 上的电压相等,即重新选择并联 M 个电阻作为输出电阻,完成 ZQ Calibration。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/982061
推荐阅读
  

闽ICP备14008679号