CodingBox Tài liệu

Two-wire interface: addresses, pages, banks & timing

Đội ngũ của chúng tôi đang thực hiện bản dịch. Bài viết này tạm thời chưa có bản tiếng Việt và đang được hiển thị bằng tiếng Anh.

Every pluggable module is managed over the same two wires — a serial clock and a serial data line — using the I²C protocol the specifications call the two-wire interface (TWI). What differs between SFP, QSFP, XFP and CMIS modules is how the address space is organised on top of it: separate devices, paged memory, or banks of pages. This material is the protocol-level view that programmers, hosts and CodingBox all rely on.

Physical layer

  • Two open-drain lines, SCL and SDA, pulled up on the host side; 3.3 V logic.
  • The module is always the slave; the host (or programmer) is the master and generates the clock.
  • Modules may stretch the clock (hold SCL low) while a microcontroller fetches data — the specifications allow up to 500 µs.
  • Presence and selection are separate pins, not bus transactions: MOD_ABS (SFP), ModPrsL and ModSelL (QSFP-class and CMIS). ModSelL lets several modules share one bus; SFP has no select pin, so hosts give each cage its own bus or a multiplexer.

Address space by specification

FamilyDevice addresses (8-bit write / 7-bit)OrganisationPage select
SFP, SFP+, SFP28 (SFF-8472)A0h / 50h identity, A2h / 51h diagnosticsA0h: 256 flat bytes; A2h: 128 flat + optional paged upper halfA2h byte 127, if A0h byte 64 bit 4 set
XFP (INF-8077i)A0h128 flat + paged upper "tables"byte 127
QSFP+, QSFP28 (SFF-8636)A0h128 flat + paged upper 128byte 127
QSFP-DD, OSFP, SFP-DD… (CMIS)A0h128 flat + banks × pages of upper 128byte 126 bank, byte 127 page

An SFP therefore needs two device addresses and no paging for the basics; everything after XFP uses one address and paging. Some legacy SFPs set A0h byte 92 bit 2 ("address change required") and need a vendor sequence before A2h responds.

Transactions

OperationSequenceNotes
Random readSTART · device addr+W · byte offset · START · device addr+R · data… · STOPthe everyday read; offset auto-increments
Sequential readcontinue clocking after the first bytewraps at 255 → 0 within the current device/page view
Current-address readSTART · device addr+R · datacontinues from the last offset — fragile if another master intervened
Byte writeSTART · addr+W · offset · data · STOPthen wait t_WR
Page writeSTART · addr+W · offset · data × n · STOPlimited by the memory device (typically 4–16 bytes) and must not cross its internal page boundary
Acknowledge pollingissue START + addr+W until the module ACKsthe fastest way to know a write cycle finished

Reading an upper page is always two transactions: write the page-select byte (127, and 126 for CMIS banks), then read 128–255. The selection persists until changed, which is why a stale page select is a classic source of "wrong content" reads.

Speed

SpecificationClock
SFF-8472 (SFP)100 kHz baseline; some modules tolerate 400 kHz
INF-8077i (XFP)100 kHz
SFF-8636 rev 2.x (QSFP)up to 400 kHz
CMIS / QSFP-DD / OSFP hardware specsup to 400 kHz

Slower is always legal. For writes most programmers drop far below the nominal clock — into the low kilohertz — because EEPROM write cycles and microcontroller-mediated modules are far more sensitive to timing than reads.

Timing that matters

ParameterTypical limitMeaning
t_init (SFP)300 msfrom power-up / TX_DISABLE negation until the module is fully operational and the bus answers
t_init (QSFP)2 suntil initialisation completes and Data_Not_Ready clears
MgmtInit (CMIS)≤ 2 s per hardware specsuntil the module leaves MgmtInit and identity is valid
t_WR40 msmaximum write cycle for a byte or sequential write; poll ACK or wait
t_clock_hold500 µsmaximum clock stretch by the module
ton_IntL200 msfrom flag event to IntL asserted
Data readybyte 110 bit 0 (SFP), byte 2 bit 0 (QSFP)do not trust monitors while set

Pitfalls and their fixes

SymptomProtocol causeFix
All FFhno ACK — wrong device address, page not implemented, module absentcheck A0h vs A2h, page bits, seating
Wrong contentstale page/bank selectwrite 127 (and 126) before every upper-page access
Corrupted bytesclock too fast, long leads, contention with a host polling DDMslow down, short cable, read on the bench not in a live switch
Write "succeeds", reads back oldwrote too fast, ignored t_WR, crossed a page-write boundarybyte writes or small chunks with waits; ACK polling
Bus hangs, SCL or SDA stuck lowinterrupted transactionclock out nine SCL pulses, then STOP; power-cycle the module
Works in switch, dead on programmermodule expects LPMode released or a select pinrespect ModSelL/LPMode; allow t_init

The bench-side diagnostics for these are collected in EEPROM read & write errors; protection schemes that ride on top of the bus (passwords, hardware WP, save commands) are in Write-protection types.

Reading in a live system

A host polls DDM every few seconds and reacts to flags; a second master on the same bus (a programmer clip, an in-band tool) causes collisions, mis-addressed writes and, at worst, a module bricked by a page write landing on the wrong offset. Read in place if you must; write on the bench.

In CodingBox

CodingBox handles the address model per form factor automatically — A0h/A2h for SFP, paging for QSFP and XFP, bank + page for CMIS — lets you set the bus speed and write timing per programmer profile, and verifies each write by reading back (Writing a module).


Nếu bạn phát hiện thông tin chưa chính xác hoặc lỗi trong bài viết này, hãy chọn đoạn liên quan và nhấn Ctrl+Enter để .