# 光纖接收器 (`fiberRx`)

> 把光纖傳來的光轉回邏輯訊號，並保留光纖損耗、靈敏度、延遲與抖動。

![fiberRx](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/fiberRx.svg)

[元件參考](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/) · [English](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/ic/fiberRx/)

**分類:** 積體電路 · **種類:** `{"definition":"fiberRx","kind":"subsystem"}`

## 何時使用

接在光纖發射器的另一端。它的光纖參數就是鏈路的參數：長度、每公尺衰減與連接器損耗。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `OPT` | 訊號 | 光纖的光輸入，接光纖發射器的 OPT |
| `VCC` | 電氣 | 接收器電源 |
| `OUT` | 電氣 | 推挽邏輯輸出 |
| `GND` | 電氣 | 接收器接地，經光纖與發射器隔離 |

## 常用參數

- `length`: Fiber length (預設值: 1)
- `alpha`: Fiber attenuation at the wavelength of the link (預設值: 0.2)
- `pSens`: Sensitivity: the least received power read as light on (預設值: -25)
- `tRx`: Delay from the light changing to OUT (both edges, includes tPwMin) (預設值: 0.00000003)
- `tPwMin`: Shortest pulse the receiver passes: a shorter one is dropped (預設值: 0.00000002)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 | 規格書來源 |
|---|---|---|---|---|---|
| `length` | m | 1 | 0 – 100k m | Fiber length | typical, user must set |
| `alpha` | dB/m | 0.2 | 0 – 10 dB/m | Fiber attenuation at the wavelength of the link | typical, user must set |
| `lossConn` | dB | 2 | 0 – 40 dB | Connector and coupling losses of the whole link | typical, user must set |
| `nGroup` | — | 1.5 | 1 – 3 | Group index of the fiber core: the time of flight is length · nGroup / c | typical, user must set |
| `pSens` | dBm | -25 | -80 – 10 dBm | Sensitivity: the least received power read as light on | typical, user must set |
| `pMax` | dBm | 0 | -60 – 20 dBm | Highest received power the receiver takes without overload | typical, user must set |
| `tRx` | s | 0.00000003 | 0 – 1m s | Delay from the light changing to OUT (both edges, includes tPwMin) | typical, user must set |
| `jitter` | s | 0.000000002 | 0 – 1m s | Peak-to-peak jitter: each edge comes up to this much later, uniformly | typical, user must set |
| `tPwMin` | s | 0.00000002 | 0 – 1m s | Shortest pulse the receiver passes: a shorter one is dropped | typical, user must set |
| `maxRate` | Bd | 10000000 | 1 – 10g Bd | Highest data rate of the receiver (used to choose a link; tPwMin enforces the pulse limit) | typical, user must set |
| `inverting` | — | 0 | 0 – 1 | 0: OUT is high while the light is on; 1: low while it is on | typical, user must set |
| `rOutHi` | Ω | 50 | 100m – 100k Ω | Output resistance to VCC when high | typical, user must set |
| `rOutLo` | Ω | 50 | 100m – 100k Ω | Output resistance to GND when low | typical, user must set |
| `vccMin` | V | 4.5 | 500m – 30 V | Lowest supply: below it the output is open | typical, user must set |
| `seed` | — | 1 | 0 – 1g | Seed of the jitter draws | assumption: any seed; the same seed gives the same run |
| `rOff` | Ω | 100000000 | 1k – 1t Ω | Off-state resistance of the output switches | assumption: leakage is not modelled |

_參數說明在兩種語言中都是英文。_

## 模型

OPT 的功率在光纖中損失 alpha 乘以 length（dB），在連接器損失 lossConn（dB）。高於靈敏度 pSens 時視為有光。短於 tPwMin 的脈衝會被濾掉。每個邊緣在光變化後 tRx 到達 OUT，再加上飛行時間 length 乘 nGroup 除以光速，以及最多 jitter 的均勻抖動（有種子，兩個求解器相同）。輸出是推挽，有光時為高（inverting = 1 時為無光時高），VCC 低於 vccMin 時斷開。接收功率高於 pMax 時內部訊號 x_over 為 1。預設值是 650 nm 塑膠光纖等級的典型值，不是某個零件的數值。

## 常見錯誤

- 預設值是典型值，使用者必須自行設定。請從接收器的規格書填入靈敏度、延遲、最小脈寬與抖動，並填入你的光纖在此波長的衰減。
- tRx 已包含脈衝濾波，所以至少要等於 tPwMin。短於 tPwMin 的 PWM 脈衝永遠到不了閘極：請檢查切換頻率下的最小工作比。
- 低於靈敏度時輸出不再跟隨輸入。請執行 fiber.linkBudget，或查看 Problems 清單：餘裕低於 3 dB 時會警告。

Problems 規則: `step.too_large`, `ground.missing`

## 規格書與來源

pSens 取接收器得到有效邏輯準位所需的輸入功率（dBm，最差值），pMax 取過載功率。tRx 取傳遞延遲，tPwMin 取它能通過的最短脈衝（由脈寬或資料速率限制得出），jitter 取峰對峰抖動，maxRate 取資料速率。alpha 取光纖在該波長的衰減（dB/m），lossConn 取鏈路的連接器與耦合損耗。以 ic.fromSpec 搭配 fiberRx 模板傳入。

## 範例

以指令 `file.openExample` 開啟範例，名稱為 `demo:fiberRx`.

---
由 `cargo xtask reference` 依使用說明文字與參數規格產生，請勿手動編輯。
