SpacemiT_K3_DDR

SpacemiT K3 DDR/LPDDR5 Clean-Room Specification

Independent interface and behavioral specification of the DDR/LPDDR5 memory subsystem on the SpacemiT K3 SoC. This documentation is designed to allow an independent implementation team (without access to vendor source code or binaries) to build a compatible DDR initialization loader and/or PHY training microcontroller (PMU) firmware.

Why “Clean Room”

This project follows the standard clean-room separation:

By transferring only interface facts, hardware constraints, memory maps, data formats, and required operational sequences—and never vendor code expression, internal symbol names, or proprietary documentation—an implementation built from these documents remains an independent work.

Warning: This is an interface and hardware contract specification, not source code. Do not consult vendor firmware sources, decompiled listings, or vendor binaries when implementing from this specification. Where behavior is not established here (see 15-open-questions.md), treat it as an open engineering question to be resolved by controlled hardware testing.


Hardware Safety Warning

Never read or write PHY/PMU MMIO registers from an operating system after boot (for example via /dev/mem). Once the bootloader finishes and hands off to the OS, the PHY/PMU interface is placed in a state where host MMIO reads stall the SoC interconnect, causing an immediate system hang (loss of serial console and network) that requires a full physical power cycle. All PHY/PMU register accesses must take place inside the first-stage bootloader while the PMU clock and ownership state are properly configured, or via JTAG. See 14-validation-and-current-status.md and 16-flash-build-and-recovery.md.


Scope

Covered

Out of Scope


Reading Order and Contents

Document Topic Summary
01-system-architecture.md System Architecture Dual controller instances, functional blocks, full-training vs. quickboot overview
02-addressing-and-access.md Addressing & Access Rules Byte offsets vs. 32-bit word indices, ARC virtual addresses, lane CSR addressing
03-ddrc-and-clock.md DDRC, DPLL & Host Ports Clock/PLL programming, DDRC configuration phases, address map, 5 host ports
04-parts-topologies-and-timings.md Parts, Topologies & Timings Part lookup tables, rate/rank/width matrices, PHY table formats, size/sentinel constants
05-message-block.md PMU Message Block 320-byte host/PMU data interface, control flags, mode registers, trained outputs
06-full-initialization.md Full Initialization Sequence Step-by-step 9-stage initialization, ownership transitions, collection, and activation
07-training-behavior.md PHY Training Behavior Swept dimensions, stage dependencies, 2D eye scoring, margins, and acceptance policy
08-mailbox-and-streaming.md Mailbox & Streaming Protocol Handshake, major messages (0x07, 0x08, 0xff), streaming framing, and error policy
09-training-results.md Training Results Per-controller 0x49a4 record (message, phypara, acsm) and reference sample stats
10-persistence-and-selection.md Persistence & Selection 0x9800 SPI flash envelope (DDRT), CRC-32 coverage, and quickboot selection rules
11-quickboot.md Quickboot Result-to-MR shadow mapping, DMEM/ACSM restoration, MemReset, and 10-step fast flow
12-arc-execution-environment.md ARC Execution Environment ARCv2 EM core, 0x1fc entry, -mrf16 register file, gp/.bss split, AUX RTC timer
13-firmware-behavioral-requirements.md Firmware Behavioral Requirements Normative hardware, ISA, memory-width, timing, and toolchain rules (BR-01 to BR-10)
14-validation-and-current-status.md Validation & Measurements Reference platform benchmarks, boot timings, validation matrix, and safe observation rules
15-open-questions.md Open Questions & Gaps Unresolved hardware, protocol, calibration, and validation questions
16-flash-build-and-recovery.md Flash, Build & Recovery Unsigned vs. signed boot chains, ARC/SPL build flags, SPI NOR flashing, and FDL recovery
appendix-message-block-fields.md Appendix: Message Block Fields Complete 293-field catalog (offsets 0x000–0x13f, CSR indices, types, directions)
appendix-phypara-order.md Appendix: phypara Order Exact 69-segment, 5170-halfword serialization table
appendix-streaming-catalog.md Appendix: Streaming Catalog Catalog of 124 observed streaming message IDs, payload lengths, and trace examples
appendix-reference-envelope.md Appendix: Reference Envelope (SPI) Complete 6400 MT/s factory SPI DDRT header, message block, phypara (5170), and ACSM (4096) dumps (0x020011 = 0x000f)
appendix-reference-envelope-fdl.md Appendix: Reference Envelopes (USB/FDL) Index and complete DDRT dumps for all 9 clean 60 Ω RX ODT USB/FDL full-training runs (E1–E3, G1–G3, K1–K3; 0x020011 = 0x006f)

Notation and Evidence Conventions


Intellectual Property and Clean-Room Boundaries


License

Copyright (C) 2026 Thalles Campagnani.

This documentation is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC-BY-SA-4.0) license. See LICENSE for the full license text.

In summary: