How to do Stable DDR4 Tuning on Ryzen: Finding the Appropriate Values of the Termination Resistance

This article contained some misunderstanding and inaccuracies, so I wrote the revised article that included my newly leaned knowledge. Please read the article linked below.

この記事にはいくつかの勘違いや不正確さが含まれていたため,私が新たに学んだ知識を含めて書き直した記事を執筆しました.以下のリンクの記事をお読みください.

https://ocod.home.blog/2020/02/05/how-to-do-stable-ddr4-tuning-on-ryzen-finding-the-appropriate-values-of-the-termination-resistance-rev-2/


On this article, I will instruction a method for stable DDR4 tuning, especially finding optimal values of the termination resistances, on Ryzen. Termination Resistance are used to match impedance that are ratio of current to voltage. Noise that causes signal degradation occurs when impedance of the side of output signal, the side of input signal, and of transmission passes (which is called the characteristic impedance) are inconsistent. If noise are more than tolerability, it will occur reading/writing errors and decreasing the processing speed. Because of that, tuning termination impedance to reduce noise is important when you use overclocked DDR4s.

Though the used processor on this time was Zen2, this method is probably valid on Zen or Zen+.

Things to Prepare

memtest86 (bootable on an USB stick)

https://www.memtest86.com/

DRAM Calculator for Ryzen v1.6.0.3 (latest version as of August 19th, 2019)

https://www.techpowerup.com/download/ryzen-dram-calculator/

*Thank you, 1usmus!

Equipment Used for the Tests for This Article

  • Ryzen 7 3700X (4300 MHz; 1.38125 V)
  • f4-3200c14d-16gfx (non-selected)
  • X470 Taichi (AGESA 1.0.0.3abb)

Step1: Set Some Basic Items

Set (slightly tight) target values in daily-use about a memory clock, memory timings, voltages, and BankGroupSwap from UEFI.

memory clock…For Zen2, the optimal memory clock is 3733 MHz or 3800 MHz ( https://ocod.home.blog/2019/12/08/why-tuning-ddr4-is-important-for-ryzen/ ). If fClk does not automatically synchronize with mClk, you should set manually fClk to 1867 MHz or 1900 MHz from UEFI.

memory timings… ( https://ocod.home.blog/2019/08/24/what-is-memory-timing-2-a-brief-description-of-tweaking-the-memory-timing/ )

voltages (in a case of using Samsung B-Die)…Set the DRAM voltage (up to 1.5 V for daily-use), VTT DDR (a stable value is slightly higher than half of DRAM Voltage), and SoC voltage (up to 1.1 V for daily-use).

BankGroupSwap…Turn BankGroupSwap and BankGroupSwapAlt off.

STEP2: Set Values of Termination Resistance (1): CAD Bus and Rtt

Then, we will start to find the optimal values of terminate resistance. The appropriate values of terminate resistance depends on the combination of a motherboard, a memory, a memory controller (on a CPU), and a value of memory clock, so you have to test each values one by one.

First, set CAD Bus and Rtt which are the values of termination resistance.

CAD Bus… Set to 20.0 Ohm, 20.0 Ohm, 20.0 Ohm, and 20.0 Ohm provisionally on the assumption that it will adjust later. (In Micron E-die, it is said that the memory timings can be easily reduced by setting some values of CAD Bus to 120 Ohm.)

Rtt… Enter the values calculated by the DRAM Calculator.

STEP3: Set Values of Termination resistance (2): Find the Optimal ProcODT

ProcODT is the values of termination resistance, too. We will test each values one by one, and safe line for daily-use is under 60 Ohm. The test for this article, I investigated from 80 Ohm to 28.2 Ohm.

Start memtest86 and choose to run test8, ‘Random Number Sequence,’ for 4 times.

Run the test for 1 and half minute and record the number of errors for each ProcODT. The one with the fewest number of errors is the optimal ProcODT (it is recommended to list some ProcODTs with fewer number of errors, because memtest86 don’t provide rigid results). If the number of errors is large (such as over 100), the value set in Step 1 is inappropriate. In that case, you should adjust some values by increasing values of the memory timing or the voltage til the number of errors around 20.

STEP4: Set Values of Termination Resistance (3): Find the Optimal CAD Bus

Run test8 of memtest86 again and note the error results (“Expected” and “Actual”) as much as possible. Then, compare the values of “Expected” and “Actual” and records the numbers of results where “Actual” is higher(/lower) than “Expected”. CAD_BUS is lower than optimal one when the numbers of result of “‘Expected'<‘Actual'” (overshoot errors) was more occur than opposite ones. And CAD_BUS is higher than optimal one when the numbers of case of “‘Expected’>’Actual'” (undershoot errors) was more occur than opposite ones.

If the number of overshoot and undershoot errors is close to the same number, that is the appropriate CAD Bus.

STEP5: Fix the memory timings or voltage

If you find the optimal ProcODT and CAD Bus, run HCI Mem Test on DRAM Calculator (6000 Mb, 240%).

And adjust timing and voltage until no error is occurred.


Appendix: Tweaking CLDO VDDP

When some errors occur though you set optimal values of above items, increase the value of VDDP may be effective. Try to increase the value of VDDP in units of 10 mV from UEFI.


Result in the Test for This Article

Clock…3733 MHz

1st timings: CL 15, tRCD_R 16, tRCD_W 16, tRP 13, tRAS 28

Command Rate: 1T

2nd timings: tRRD 41, tRRD_S 4, tRRD_L 6, tFAW 16, tWTR_S 6, tWTR_L 8, tWR 12, tRFC 300, tRFC2 223, tRFC4 137, tCWL 14, tRTP 6, tCKE 1

3rd timings: TrdrdScL 5, TwrwrScL 5, TwrwrScl 5, Trdwr 8, Twrrd 2, TwrwrSc 1, TwrwrSd 6, TwrwrDd 6, TrdrdSc 1, TrdrdSd 4, TrdrdDd 4

Voltages: DRAM Voltage 1.500 V, VTT DDR 0.770 V SOC Voltage 1.125 V

BankGroupSwap: BankGroupSwap off, BankGroupSwapAlt off

Rtt: RttNom Rtt_Nom Disable, RttWr Dynamic ODT off, RttPark RZQ/5

ProcODT: 43.6 Ohm

CAD Bus: 24.0 Ohm, 24.0 Ohm, 24.0 Ohm, 24.0 Ohm

CLDO VDDP: Auto (900 mV)


今回は,Ryzenにおける安定したメモリの調整方法,特に,適切な終端抵抗の値を調べる方法を説明します.終端抵抗とは,インピーダンス(電流と電圧の比)を整合させるためのものです.信号劣化を引き起こすノイズは,信号の発信側と受信側,そして伝送路のインピーダンス(これを特性インピーダンスといいます)が不整合な場合に生じます.ノイズが許容量を超えると,読み書きのエラーや処理速度の低下が生じます.このため,ノイズを抑えるための終端抵抗の調整は,オーバークロックされたDDR4の使用において重要になります.

今回検証に用いたのはZen2プロセッサですが,この方法はおそらく,ZenやZen+でも用いることができるでしょう.

用意するもの

memtest86(USBメモリーから起動可能)

https://www.memtest86.com/

DRAM Calculator for Ryzen v1.6.0.3(2019年8月19日時点での最新版)

※Thank you, 1usmus!

https://www.techpowerup.com/download/ryzen-dram-calculator/

今回の検証機器

  • Ryzen 7 3700X(4300 MHz; 1.38125 V)
  • f4-3200c14d-16gfx(非選別)
  • X470 Taichi(AGESA 1.0.0.3abb)

Step1 基本的な項目の設定

メモリクロック,メモリタイミング,電圧,BankGroupSwapについて,常用の目標値(少しきつめ)をUEFIから設定します.

メモリクロック… Zen2の場合,最適なメモリクロックは3733 MHzまたは3800 MHzです https://ocod.home.blog/2019/12/08/why-tuning-ddr4-is-important-for-ryzen/ .fClkが自動でmClkと自動的に同期しない場合,UEFIから手動で1867 MHzまたは1900 MHzに設定します.

メモリタイミング… ( https://ocod.home.blog/2019/08/24/what-is-memory-timing-2-a-brief-description-of-tweaking-the-memory-timing/ )

電圧(Samsung B-dieを使用する場合)… DRAM電圧(常用なら1.5 Vまで),VTT DDR(DRAM電圧の半分より少し高めが安定します),およびSoC電圧(常用なら1.1 Vまで )を設定します.

BankGroupSwap… BankGroupSwapおよびBankGroupSwapAltをoffにします.

Step2 終端抵抗の値を設定する (1): CAD BusとRtt

適切な終端抵抗の値を探ります.適切な終端抵抗の値は,マザーボード,メモリ, (CPUの)メモリコントローラ,メモリクロックの組み合わせに依存するため,しらみつぶしにテストしていくしかありません.

まず,終端抵抗の値であるところの,CAD BusとRttを設定します.

CAD Bus… 後で調整することを前提に,暫定的に20.0 Ω, 20.0 Ω, 20.0 Ω, 20.0 Ωで設定します.(マイクロンE-Dieにおいては,CAD Busの値のいくつかを120Ωにするとメモリタイミングを簡単に詰められるようです.)

Rtt… DRAM Calculatorで算出された値を入力します.

Step3 終端抵抗の値を設定する (2): 最適なProcODTを調べる

ProcODTも,終端抵抗の値です.ここではProcODTの値を1つずつ調べていきますが,常用においては60 Ω以下が安全です.今回私は80 Ωから28.2 Ωまでを調べました.

memtest86を起動し,test8「Random Number Sequence」のみを4回実行します.

テストを1分30秒実行し,それぞれのProcODTごとのエラー数を記録します.もっともエラー数の少ないものが最適なProcODTになります(テスト結果に誤差が生じる場合があるため,少ないエラー数のProcODTをいくつかリストアップしておくことをおすすめします).エラー数が多い場合(100を超える等),Step1で設定した数値は不適切です.メモリタイミングを緩めたり電圧を上げる等して,20付近のエラー数になるよう調整してください.

Step4 終端抵抗の値を設定する (3): 最適なCAD Busを調べる

再度memtest86のtest8を実行し,生じたエラーの結果(Expected, Actual)を可能な限りメモします.そして,ExpectedとActualの数値を比較し、ActualがExpectedより高い結果の数と低い結果の数を記録します.ActualがExpectedより高い結果が多い(オーバーシュートエラーが多い)場合はCAD Busが理想値より低く,ActualがExpectedより低い結果が多い(アンダーシュートエラーが多い)場合は CAD Busが理想値より高いことを示しています.

オーバーシュートエラーとアンダーシュートエラーが同数近くなったら,それが適切なCAD Busです.

Step5 メモリタイミングと電圧を修正する

ProcPDTとCAD Busが決まったら,DRAM CalculatorのHCI Mem Test(6000 MBを240%)を実行します.

エラーが0になるまでタイミングと電圧を調整します.


補足 CLDO_VDDPを調整する

上記の各項目について最適な値を設定しているにもかかわらずエラーが生じる場合,VDDPを上げると効果があるかもしれません.UEFIから,VDDPを10 mV単位で上げてみてください.


今回の結果

Clock…3733 MHz

1st timings: CL 15, tRCD_R 16, tRCD_W 16, tRP 13, tRAS 28

Command Rate: 1T

2nd timings: tRRD 41, tRRD_S 4, tRRD_L 6, tFAW 16, tWTR_S 6, tWTR_L 8, tWR 12, tRFC 300, tRFC2 223, tRFC4 137, tCWL 14, tRTP 6, tCKE 1

3rd timings: TrdrdScL 5, TwrwrScL 5, TwrwrScl 5, Trdwr 8, Twrrd 2, TwrwrSc 1, TwrwrSd 6, TwrwrDd 6, TrdrdSc 1, TrdrdSd 4, TrdrdDd 4

Voltages: DRAM Voltage 1.500 V, VTT DDR 0.770 V, SOC Voltage 1.125 V

BankGroupSwap: BankGroupSwap off, BankGroupSwapAlt off

Rtt: RttNom Rtt_Nom Disable, RttWr Dynamic ODT off, RttPark RZQ/5

ProcODT: 43.6 Ω

CAD Bus: 24.0 Ω, 24.0 Ω, 24.0 Ω, 24.0 Ω

CLDO VDDP: Auto(900 mV)

Leave a Reply