diff --git a/SPEC-FX.md b/SPEC-FX.md index 514273f..69db1c4 100644 --- a/SPEC-FX.md +++ b/SPEC-FX.md @@ -2,21 +2,24 @@ # pico-serial FX — FPGA line board for ADSL or ISDN (study, draft 0.0) -One board whose line personality is set by its gateware and the host's -software: an **ADSL / ADSL2+** modem (or the exchange end for vintage -ADSL modems), an **ISDN U** line (2B1Q or 4B3T, either end), an **ISDN -S0** port, or a faster successor to the WB stick's bare-pair mode -([SPEC-WB.md](SPEC-WB.md), whose §9 left ADSL for "a different chip"). +pico-serial FX is one board. Its gateware and the software on the host set +its line function. It can be one of these items: +- An **ADSL / ADSL2+** modem (or the exchange end for vintage ADSL modems). +- An **ISDN U** line (2B1Q or 4B3T, either end). +- An **ISDN S0** port. +- A faster successor to the bare-pair mode of the WB stick + ([SPEC-WB.md](SPEC-WB.md). Its §9 left ADSL for "a different chip"). -The idea is the one behind every D-Modem stick, pushed further: the board -is a **wideband line interface** (a fast ADC and DAC, a line driver, a -transformer) and an FPGA that moves samples to USB 2.0 High Speed and -handles bit timing where it matters. The modem, here a DMT transceiver -or a 2B1Q echo canceller, runs in **D-Modem on the host**, as V.92 does -for the Line stick. +The concept is the same as for all D-Modem sticks, but it goes further. The +board is a **wideband line interface** (a fast ADC and DAC, a line driver, a +transformer) and an FPGA. The FPGA moves samples to USB 2.0 High Speed. It +also controls the bit timing where this is important. The modem (here, a +DMT transceiver or a 2B1Q echo canceller) runs in **D-Modem on the host**, +as V.92 does for the Line stick. -Status: a feasibility study. Nothing here is checked against stock to -the depth of the other specs; part numbers are candidates. +Status: a feasibility study. We did not compare the parts in this document +with the stock to the same depth as in the other specs. The part numbers +are candidates. --- @@ -27,35 +30,39 @@ the depth of the other specs; part numbers are candidates. | ADSL, ADSL2+ ATU-R (a customer modem, to a DSLAM) | line | samples at 2.208 / 4.416 MHz, clock tracking | DMT (G.992.1/.3/.5), G.994.1 handshake, training, trellis, Reed-Solomon, interleaving; ATM (AAL5, RFC 2684) or PTM; PPPoE/PPPoA to a network interface | | ADSL ATU-C (the exchange end, for vintage ADSL modems and routers) | line | the same, more transmit power | the same, the other side of each procedure | | ISDN U, NT1 or LT side | line | samples (about 1 MHz) | 2B1Q (80 kbaud, ETSI TS 102 080 annex A, ANSI T1.601) or 4B3T (120 kbaud, annex B, Germany); echo canceller; then LAPD and Q.931 as for the S0 stick | -| ISDN S0, TE or NT | S0 | I.430's line code, framing, D-channel access (the S0 stick's soft S0, [SPEC-S0.md](SPEC-S0.md) §3–6, in logic instead of PIO) | as the S0 stick (SPEC-S0 §9) | -| Bare pair, wideband (WB's mode, more tones) | line | samples | D-Modem's WB pump with tones to 1 MHz or more | -| SHDSL (G.991.2) | line | samples | later, if wanted | +| ISDN S0, TE or NT | S0 | the line code, framing and D-channel access of I.430 (the soft S0 of the S0 stick, [SPEC-S0.md](SPEC-S0.md) §3–6, in logic, not in PIO) | as the S0 stick (SPEC-S0 §9) | +| Bare pair, wideband (the mode of WB, more tones) | line | samples | the WB pump of D-Modem with tones to 1 MHz or more | +| SHDSL (G.991.2) | line | samples | later, if necessary | -**"Depending on the firmware"** comes down to this: one gateware does -every mode (a sample streamer at a set rate, plus the S0 framer), and the -host picks the mode. The gateware updates over USB (DFU into its SPI -flash, with a protected golden image to fall back to), so a mode that -later needs work in logic (a hardware FFT, say) is a gateware update, -not a new board. +**"Depending on the firmware"** means this: one gateware does all modes (a +sample streamer at a set rate, and the S0 framer). The host selects the +mode. You can update the gateware through USB (DFU into its SPI flash, with +a protected golden image as a fallback). Thus, if a mode needs work in logic +later (for example, a hardware FFT), you do a gateware update. A new board +is not necessary. ### 1.1 ADSL and ISDN U on the same pair -Both are two-wire, echo-cancelled or frequency-split signals on a -telephone pair, below 2.2 MHz. One line front end serves both: the -converters run at whatever rate the mode needs, and the transformer and -hybrid cover 10 kHz to 2.2 MHz. The S0 port is different (four wires, -192 kbit/s pulses, a bus) and gets its own small front end and jack. +Both are two-wire signals on a telephone pair, below 2.2 MHz. They use echo +cancellation or a frequency split. One line front end is sufficient for +the two. The converters run at the rate that the mode needs. The +transformer and the hybrid operate from 10 kHz to 2.2 MHz. The S0 port is +different (four wires, 192 kbit/s pulses, a bus). It has its own small +front end and jack. ### 1.2 Where these lines still are -ISDN and ADSL are being switched off in many countries (Germany's ISDN -was largely gone by 2022; ADSL is following fibre and VDSL out). So the board's -most lasting use is likely **being the exchange**: the ATU-C for an old -ADSL router, the LT for an NTBA (which then gives S0 and power to ISDN -phones, the PS1 problem of SPEC-S0 §4.6), or NT mode for terminal -adapters, all with D-Modem behind it. ATU-R mode still matters where -ADSL is still sold, and that is also the hardest interoperability test -(§6). +Many countries are switching off ISDN and ADSL. (In Germany, almost all +ISDN was removed by 2022. Fibre and VDSL are now replacing ADSL.) Thus the +most durable use of the board is probably **being the exchange**: +- The ATU-C for an old ADSL router. +- The LT for an NTBA. (The NTBA then gives S0 and power to ISDN phones: the + PS1 problem of SPEC-S0 §4.6.) +- NT mode for terminal adapters. + +All of these modes have D-Modem behind them. ATU-R mode is still important +where ADSL is still sold. It is also the most difficult interoperability +test (§6). --- @@ -76,24 +83,29 @@ ADSL is still sold, and that is also the hardest interoperability test ## 3. Choosing the FPGA -The FPGA's job is modest in the default gateware: a USB 2.0 HS device -core (ULPI), FIFOs, the converter bus at up to about 35 MHz, an I2C -master, the S0 framer. A few thousand LUTs. What sets the size is -headroom: moving the DMT's FFTs, trellis or Reed-Solomon into logic -later (for a slow host, or Android) wants multipliers and block RAM. +In the default gateware, the function of the FPGA is small: +- A USB 2.0 HS device core (ULPI). +- FIFOs. +- The converter bus at up to about 35 MHz. +- An I2C master. +- The S0 framer. + +This needs some thousand LUTs. The size is set by the headroom. If we move +the FFTs, trellis or Reed-Solomon of the DMT into logic later (for a slow +host, or for Android), this needs multipliers and block RAM. | FPGA | Logic | DSP | Toolchain | Price, availability | | |---|---|---|---|---|---| -| **Lattice ECP5 LFE5U-25F** (caBGA-256, 0.8 mm) | 24k LUT | 28 18×18 multipliers, 1 Mbit EBR | **open and mature**: Yosys, nextpnr-ecp5, Project Trellis; LiteX; LUNA's USB HS core | about $10–20; LCSC stocks the ECP5 family (the 45F at $17) | **recommended** | -| Cologne Chip GateMate CCGM1A1 (FBGA-324) | 20k LE | multipliers built from logic cells | open: Yosys + nextpnr (himbaechel), Cologne Chip's own tools | DigiKey about $27 one off, $18 in volume; not LCSC | the same company as the XHFC; one supplier for both | -| Lattice iCE40UP5K | 5k LUT | 8 multipliers, 1 Mbit SPRAM | open, mature | cheap, LCSC | enough for streaming and S0, no headroom; a HS ULPI core is tight | -| Gowin GW2A-18 | 20k LUT | 48 multipliers | vendor IDE; open (Apicula) is partial | cheap, LCSC | the toolchain is the catch | +| **Lattice ECP5 LFE5U-25F** (caBGA-256, 0.8 mm) | 24k LUT | 28 18×18 multipliers, 1 Mbit EBR | **open and mature**: Yosys, nextpnr-ecp5, Project Trellis; LiteX; the USB HS core of LUNA | about $10–20; LCSC has the ECP5 family in stock (the 45F at $17) | **recommended** | +| Cologne Chip GateMate CCGM1A1 (FBGA-324) | 20k LE | multipliers made from logic cells | open: Yosys + nextpnr (himbaechel), the tools of Cologne Chip | DigiKey about $27 for one, $18 in volume; not LCSC | the same company as the XHFC; one supplier for both | +| Lattice iCE40UP5K | 5k LUT | 8 multipliers, 1 Mbit SPRAM | open, mature | cheap, LCSC | sufficient for streaming and S0, but no headroom; a HS ULPI core is almost too large | +| Gowin GW2A-18 | 20k LUT | 48 multipliers | vendor IDE; the open toolchain (Apicula) is partial | cheap, LCSC | the toolchain is the problem | -**ECP5-25F:** the open toolchain is the best-trodden of the four, it has -real multipliers for later DSP, JLC assembles BGA-256, and there are -open USB HS cores (LUNA, as on Great Scott Gadgets' Cynthion) and SoC -frameworks (LiteX) to start from. GateMate is the alternative if one -order from Cologne Chip (XHFC and FPGA) suits. +**ECP5-25F:** of the four, it has the open toolchain with the most use. It +has real multipliers for DSP in the future. JLC assembles BGA-256. There +are open USB HS cores (LUNA, as on the Cynthion of Great Scott Gadgets) and +SoC frameworks (LiteX) to start from. GateMate is the alternative if one +order from Cologne Chip (XHFC and FPGA) is better. --- @@ -101,36 +113,43 @@ order from Cologne Chip (XHFC and FPGA) suits. ### 4.1 Converters: Analog Devices AD9866 -A "broadband modem mixed-signal front end": a 12-bit ADC (to 80 MSPS) -with a receive PGA, a 12-bit TxDAC with a transmit PGA, made for -HomePlug and DSL-class modems; the Hermes-Lite 2 SDR uses it, so there -is open gateware for its bus. LCSC lists it (AD9866BCP, C7459112). -**ADI marks it not recommended for new designs**; the pin-compatible -AD9869 is the cheaper sibling (without the AD9866's current output -amplifier). Like the Line stick's Si3056, fine to build on, buy ahead -for a run. The fallback is a separate ADC and DAC (a 12–14 bit, 20–65 -MSPS pair) and a PGA: more parts, the same gateware shape. +The AD9866 is a "broadband modem mixed-signal front end". It has a 12-bit +ADC (to 80 MSPS) with a receive PGA, and a 12-bit TxDAC with a transmit +PGA. It is made for HomePlug and DSL-class modems. The Hermes-Lite 2 SDR +uses it, thus there is open gateware for its bus. LCSC lists it +(AD9866BCP, C7459112). -Rates: ADSL2+ needs 4.416 MHz at the line (512 tones of 4.3125 kHz, -to 2.208 MHz); the converters run at 4× that, 17.664 MHz, with the -FPGA decimating and interpolating, so the analogue filters are gentle. -ADSL is 2.208 MHz at the line. ISDN U and WB run slower. +**ADI marks it as not recommended for new designs.** The pin-compatible +AD9869 is the cheaper sibling (without the current output amplifier of the +AD9866). As with the Si3056 of the Line stick, it is satisfactory for a +build, but buy the parts early for a production run. The fallback is a +separate ADC and DAC (a 12–14 bit, 20–65 MSPS pair) and a PGA: more parts, +but the same gateware shape. + +Rates: ADSL2+ needs 4.416 MHz at the line (512 tones of 4.3125 kHz, to +2.208 MHz). The converters run at 4× that rate, 17.664 MHz. The FPGA does +the decimation and the interpolation, thus the analogue filters can be +gentle. ADSL is 2.208 MHz at the line. ISDN U and WB run slower. ### 4.2 Clocks: Si5351 -ADSL's customer end must run its sample clock locked to the exchange's -(the pilot tone), and an LT must hold the U line's clock; D-Modem's WB -receiver tracks crystals in software. A **Si5351** (or MS5351M, at -LCSC) makes the converters' clock from a 25 MHz crystal, at any rate the -mode needs, and the host pulls it by fractions of a ppm over I2C as its -timing loop asks. (A VCXO tuned by a DAC, as Osmocom's icE1usb does, is -the alternative; the Si5351 covers every mode's rate with one part.) +These modes need an accurate clock: +- The customer end of ADSL must lock its sample clock to the clock of the + exchange (the pilot tone). +- An LT must hold the clock of the U line. +- The WB receiver of D-Modem tracks crystals in software. + +A **Si5351** (or MS5351M, at LCSC) makes the clock of the converters from a +25 MHz crystal, at the rate that the mode needs. The host changes it by +fractions of a ppm through I2C, as its timing loop requests. (A VCXO tuned +by a DAC, as on the icE1usb of Osmocom, is the alternative. The Si5351 gives +the rate of all modes with one part.) ### 4.3 Line driver: TI THS6222 -A differential current-feedback line driver for DSL and power-line -modems, single supply 8–32 V, active at TI. ADSL's transmit power sets -it: +The THS6222 is a differential current-feedback line driver for DSL and +power-line modems. It has a single supply of 8–32 V, and it is active at +TI. The transmit power of ADSL sets the driver: | End | Transmit | | |---|---|---| @@ -142,64 +161,79 @@ A boost converter makes 12 V from VBUS for the driver. ### 4.4 Hybrid, transformer, protection -As the WB stick, scaled up in frequency: +The design is the same as on the WB stick, but for higher frequencies: - An **xDSL line transformer** (an ADSL2+ CPE type, 1:1 or 1:2, flat to - 2.2 MHz and down to about 10 kHz for ISDN U; Pulse and Bourns make + 2.2 MHz and down to about 10 kHz for ISDN U. Pulse and Bourns make them). -- A resistive **hybrid**: the replica arm subtracts our own transmit - before the AFE's receive PGA (frequency division does the rest for - ADSL; 2B1Q needs the host's echo canceller behind it). -- **DC block** capacitors in the line side (≥ 250 V): an ADSL pair can - carry the phone line's −48 V and ringing, an ISDN U pair the exchange's - remote feed (up to about 100 V). **No splitter** on the board: ADSL over - a voice line needs the usual external splitter or microfilter. -- The Line and WB sticks' sidactor and telecom fuse. +- A resistive **hybrid**: the replica arm subtracts our transmit signal + before the receive PGA of the AFE. (For ADSL, frequency division removes + the remaining signal. 2B1Q needs the echo canceller of the host behind + it.) +- **DC block** capacitors in the line side (≥ 250 V). -The LT side of ISDN U would also need to feed power to the NTBA on rev A -or not at all; most NTBAs run from their own mains supply. + > **CAUTION: USE DC BLOCK CAPACITORS WITH A RATING OF 250 V OR MORE.** + > An ADSL pair can have the −48 V and the ring signal of the phone line. + > An ISDN U pair can have the remote feed of the exchange (up to about + > 100 V). + + There is **no splitter** on the board. ADSL on a voice line needs the + usual external splitter or microfilter. +- The sidactor and telecom fuse of the Line and WB sticks. + +On the LT side of ISDN U, rev A must also feed power to the NTBA, or not +feed power at all. Most NTBAs operate from their own mains supply. --- ## 5. The S0 front end -The S0 stick's circuit (SPEC-S0 §4): the tri-state buffer driving the -transmit transformer's chip winding through resistors, two fast -comparators against a set threshold on the receive transformer, the -1:2 S0 transformer pair for isolation, the same 100 Ω terminations and -protection, with the FPGA in place of the PIO and core 1. In logic, -the frame timing, the two-bit TE offset and the D-channel's echo check -are exact by construction. A board-mounted XHFC-1SU on the FPGA's SPI -instead is the conservative choice; it costs a separate order and -supports only S0, which the S0 stick already does. +This is the circuit of the S0 stick (SPEC-S0 §4), with the FPGA in place +of the PIO and core 1: +- The tri-state buffer drives the chip winding of the transmit transformer + through resistors. +- Two fast comparators compare the receive transformer with a set + threshold. +- The 1:2 S0 transformer pair gives isolation. +- The same 100 Ω terminations and protection. + +In logic, the frame timing, the two-bit TE offset and the echo check of the +D-channel are exact by design. The conservative alternative is a +board-mounted XHFC-1SU on the SPI of the FPGA. But it needs a separate +order, and it supports only S0. The S0 stick already does S0. --- ## 6. USB and the host -- **USB 2.0 High Speed** through a ULPI PHY (Microchip USB3320), the - device core in gateware; the same Microsoft OS 2.0 descriptors as the - sticks (WinUSB, no INF) and a pid.codes ID. -- ADSL2+ at the line's 4.416 MHz, 16-bit, is 8.8 MB/s each way, about - 18 MB/s in all: comfortable on HS bulk or high-bandwidth isochronous - endpoints (about 35–40 MB/s usable). Full Speed (the RP2040's) can't - carry it, which is why this board is not an RP2040 stick. -- **Host compute:** ADSL2+ is 4000 symbols a second, each a 1024-point - FFT and IFFT, a time-domain equaliser (tens of taps at 4.4 MHz, about - 150 M multiply-adds a second), and Viterbi and Reed-Solomon at up to - 24 Mbit/s. A few tens of percent of one desktop core with SIMD; harder - on a phone, which is where moving the FFTs into the ECP5's - multipliers would pay. -- **dmodemd:** a `--usb` device kind with a mode; ADSL gives a network - interface (tun/tap with PPPoE or PPPoA) rather than a pty; ISDN U and - S0 give the same line backend as the S0 stick (LAPD, Q.931, two - B-channels, CAPI through `dmodem-capid`). +- **USB 2.0 High Speed** through a ULPI PHY (Microchip USB3320), with the + device core in gateware. The board uses the same Microsoft OS 2.0 + descriptors as the sticks (WinUSB, no INF) and a pid.codes ID. +- ADSL2+ at the 4.416 MHz of the line, 16-bit, is 8.8 MB/s in each + direction, about 18 MB/s in total. This is easy on HS bulk or + high-bandwidth isochronous endpoints (about 35–40 MB/s usable). Full + Speed (the USB of the RP2040) cannot send this rate. This is why this + board is not an RP2040 stick. +- **Host compute:** ADSL2+ is 4000 symbols each second. Each symbol needs: + - A 1024-point FFT and IFFT. + - A time-domain equaliser (tens of taps at 4.4 MHz, about 150 M + multiply-adds each second). + - Viterbi and Reed-Solomon at up to 24 Mbit/s. + + This is some tens of percent of one desktop core with SIMD. It is more + difficult on a phone. On a phone, it can be better to move the FFTs into + the multipliers of the ECP5. +- **dmodemd:** a `--usb` device type with a mode. ADSL gives a network + interface (tun/tap with PPPoE or PPPoA), not a pty. ISDN U and S0 give + the same line backend as the S0 stick (LAPD, Q.931, two B-channels, CAPI + through `dmodem-capid`). --- ## 7. Power -USB-C, 5 V, the board asking for **1.5 A** through its CC pins and -running at reduced transmit power when the host offers only 500 mA. +The power comes from USB-C, 5 V. The board requests **1.5 A** through its +CC pins. When the host gives only 500 mA, the board operates at a lower +transmit power. | | ATU-R, ISDN | ATU-C | |---|---|---| @@ -209,55 +243,58 @@ running at reduced transmit power when the host offers only 500 mA. | THS6222 and the boost | 0.3 W | 1–1.5 W | | **Total** | **about 1–1.5 W** (within 500 mA) | **about 2–2.5 W** (1.5 A USB-C) | -To check against the datasheets before a netlist; these are typical -figures for the class. +These are typical values for this class of parts. Compare them with the +datasheets before you make a netlist. --- ## 8. Size -Not a stick: two jacks (RJ11 for the line, RJ45 for S0), a BGA FPGA, -the AFE and the driver's boost make a small box, about 70 × 45 mm, four -layers (the BGA's escape and the AFE's ground). +This board is not a stick. It has two jacks (RJ11 for the line, RJ45 for +S0), a BGA FPGA, the AFE and the boost of the driver. Thus it is a small +box, about 70 × 45 mm, with four layers (for the escape of the BGA and the +ground of the AFE). --- ## 9. Work and risk -| Part | Size of the job | Risk | +| Part | Size of the work | Risk | |---|---|---| -| Board (FPGA, USB HS, AFE, line side) | large, but known: SDR boards are built this way | the AFE's NRND status; analogue layout at 2 MHz with 12 V drive | +| Board (FPGA, USB HS, AFE, line side) | large, but known: SDR boards use this design | the NRND status of the AFE; analogue layout at 2 MHz with 12 V drive | | Gateware: streamer, USB, clocks, S0 | medium; open cores exist for USB HS and the AD9866 bus | low | -| ISDN U on the host | medium: 2B1Q and its echo canceller are textbook, then the S0 stick's LAPD and Q.931 | low to medium | -| ADSL on the host | **very large**: G.992.1/.3/.5 and G.994.1 (ITU-T publishes them free), training, bit swapping, ATM or PTM | **high**: no open ADSL transceiver to build on that I know of, and DSLAMs (Broadcom, Lantiq, Ikanos chipsets) are strict about handshakes and timing | -| ATU-C for vintage ADSL modems | the same transceiver, the other end | lower than ATU-R: our end sets the rules, old CPE expect G.992.1 | +| ISDN U on the host | medium: 2B1Q and its echo canceller are well known, then the LAPD and Q.931 of the S0 stick | low to medium | +| ADSL on the host | **very large**: G.992.1/.3/.5 and G.994.1 (ITU-T publishes them free of charge), training, bit swapping, ATM or PTM | **high**: I know of no open ADSL transceiver to start from. DSLAMs (Broadcom, Lantiq, Ikanos chipsets) are strict about handshakes and timing | +| ATU-C for vintage ADSL modems | the same transceiver, the other end | lower than ATU-R: our end sets the rules, and old CPE expect G.992.1 | -So the board is feasible, and the hardware is not the hard part. ADSL is -a multi-month software project on the host, on the scale of D-Modem's -V.90/V.92. +Thus the board is feasible, and the hardware is not the difficult part. +ADSL is a software project on the host that takes many months, of the same +size as the V.90/V.92 of D-Modem. --- ## 10. Recommendation -1. Keep the **S0 stick** (SPEC-S0) as the ISDN path to build first: one - cheap board, the soft S0 proven there first, and its host software (LAPD, `s0_line`) is - what the FX board's ISDN modes reuse. -2. Build the **FX board** as the line lab after it: ECP5-25F, USB3320, +1. Keep the **S0 stick** (SPEC-S0) as the first ISDN path to build. It is + one cheap board, it proves the soft S0 first, and the ISDN modes of the + FX board use its host software again (LAPD, `s0_line`). +2. After that, build the **FX board** as the line lab: ECP5-25F, USB3320, AD9866, THS6222, Si5351; the line front end for ADSL, ISDN U and WB, - and a soft S0 port. Bring up ISDN U and WB first (smaller, and they - test the AFE and clocks), then the ADSL ATU-C against an old ADSL - router, then the ATU-R against a real DSLAM. + and a soft S0 port. Do the bring-up in this sequence: + 1. ISDN U and WB (they are smaller, and they test the AFE and the + clocks). + 2. The ADSL ATU-C against an old ADSL router. + 3. The ATU-R against a real DSLAM. ## 11. Open questions -1. The AD9866's stock and life (or design for the AD9869 / a discrete +1. The stock and life of the AD9866 (or design for the AD9869 / a discrete ADC and DAC from the start). -2. An xDSL transformer that is also flat enough down to ISDN U's - band (2B1Q has energy below 10 kHz). -3. ADSL annex A (over POTS) or B (over ISDN) first: the band plan, set - by where it will be used. -4. Whether the LT side of ISDN U should feed an NTBA (about 90 V remote - feed): a separate, isolated supply, probably not on this board. -5. ECP5-25F or GateMate (one supplier with the XHFC, or the more - established toolchain). +2. An xDSL transformer that is also sufficiently flat down to the band of + ISDN U (2B1Q has energy below 10 kHz). +3. ADSL annex A (over POTS) or B (over ISDN) first: the location of use + sets the band plan. +4. Must the LT side of ISDN U feed an NTBA (about 90 V remote feed)? This + needs a separate, isolated supply, probably not on this board. +5. ECP5-25F or GateMate (one supplier with the XHFC, or the toolchain with + more use)?