SpacemiT_K1_DDR

← Previous: One Training Pass Index Next: DQS Read Gate →

Write Leveling

Goal

Align DQS with CK at the DRAM, for each rank and each byte. The software does not compute the delay: it asks the PI, and the result lands in byte + 0x24 of the active slice (phy.md).

Recipe

PI_WL_CFG (ddr+0x13e8) = 0x0a641e44        /* once, before the first rank */
for cs in 1 .. cs_num:
    PI_CMD (ddr+0x13d0) = 0x10400000 | (cs << 24)
    wait (PI_STATUS & 0x1) == 0x1          /* software timeout */

Parameters

PI_WL_CFG (ddr+0x13e8) resets to 0x0a301e44 (byte [23:16] = 0x30). Training needs 0x0a641e44 (byte [23:16] = 0x64) written before the first rank. The subfields of this word are sequencer parameters whose exact hardware meaning is opaque (pi-training-engine.md).

Effects on the PHY

Typical results (reference board)

WL taps, bytes b0 b1 b2 b3:

Rate CS0 CS1
1200 MT/s 18 21 17 22 17 20 17 21
1066 MT/s 18 20 17 22 —
2400 MT/s 19–20 22 20 23 19 21–22 20 23
2666 MT/s 19 21 19 23 19 21 20 22
≈1333 MT/s (fp0 with the 2666 VCO), cold first pass 17 20 16 21 —

Range 17–23 taps, different per byte and per rank. Acceptance: distinct per byte and rank, inside ≈17–23 at the final frequency point.

On the 16 GiB Micron board the same stage produces, per pass:

Pass / rate CS0 CS1
fp0 cold / 1200 MT/s 20 23 19 22 19 22 19 22
fp0 second / 1200 MT/s 20 22 19 22 19 23 19 22
fp1 / 1066 MT/s 20 23 19 22 20 23 19 22
fp2 / 2400 MT/s 21 24 20 23 21 24 19 23

The values, per-byte spread and acceptance range (19–24) match the 8 GiB reference board.

Independent measurement of the WL window (memory-pattern sweep)

The WL delay can be characterised without the PI, like the Rx/Tx delay words:

  1. save the byte + 0x24 word;
  2. for each code, write (save & ~0x3f) | code and run the memory-pattern test (write 4 MiB, read back 3 MiB so the checked part is out of cache);
  3. the codes with 0 errors form the window; its centre is the sampling point;
  4. restore the saved word and re-check (0 errors).

Measured on the 8 GiB reference board (CS0) and on the 16 GiB Micron board (CS1 row), per byte (codes of the 5-bit field):

Pass byte 0 byte 1 byte 2 byte 3 PI left
1200 MT/s (fp0) 8..27 (20) 11..31 (21) 6..29 (24) 8..31 (24) 18 / 21 / 17 / 22
1066 MT/s (fp1) 6..29 (24) 9..31 (23) 6..30 (25) 7..31 (25) 18 / 21 / 18 / 22
2666 MT/s (fp2) 15..22 (8) 16..24 (9) 15..23 (9) 16..27 (12) 19 / 21 / 20 / 23
2666 MT/s, CS1 (16 GiB) 15..23 (9) 18..25 (8) 13..24 (12) 16..27 (12) 20 / 23 / 19 / 22

Notes:

Gaps


← Previous: One Training Pass Index Next: DQS Read Gate →