FReLIT-CMOS
Firmware-defined Regional Light Integration Timing
One physical sensor. Multiple logical cameras.
English | 简体中文
FReLIT-CMOS is a non-commercial open-source firmware and sensor-timing research project for off-the-shelf consumer DSLRs, initially verified on a stock Nikon D5100 (Sony IMX071 16.2 MP APS-C sensor, 4.78 µm pixel pitch, RGGB Bayer array, official firmware v1.01b).
Without custom silicon, circuit modification, or camera firmware ROM patching, FReLIT-CMOS loads a 1.7 KB control program into volatile camera RAM during Live View to take over the sensor bus, inject on-demand row-band readout and sleep commands, and apply the camera’s native 14-bit still-capture hardware parameters—enabling one physical sensor to serve multiple independent exposure tasks for computational imaging, multi-scale HDR, and open-protocol scientific imaging experiments.
Real-silicon capture on a stock Nikon D5100 (135 mm lens, identical linear 14-bit RGGB demosaicing across all frames, no local HDR): during a single 4.5 s lower-half exposure, the upper half independently captures four sharp 0.10 s frames (45× exposure ratio; lower-half median 3598 vs. 3545 ADU conventional control, Δ 1.5%).
How It Works
1. Comparing the Two Stock Capture Paths
| Dimension |
Still Capture |
Live View |
| Shutter & mirror |
Closes mechanical shutter and drops mirror after every frame |
Mirror stays locked up; mechanical shutter stays continuously open |
| Control model |
Closed state machine executes one fixed global exposure, fully locked |
Continuous electronic frame loop with USB service channel online |
| Native quality |
Full native 14-bit (~15,800 linear levels, ~1.2 ADU read noise) |
Locked to 10-bit ADC + 12-bit crop (256 levels / 8-bit) with 10–30 fps readout glow |
| Mid-exposure commands |
Not possible (cannot interrupt or read partial rows mid-exposure) |
Possible (open shutter + interruptible electronic loop) |
2. Mid-Stream Takeover & Independent Row-Band Exposure
Inside the Nikon D5100, three core hardware blocks work together: the EXPEED 2 main processor, the EI-155 external timing generator, and the Sony IMX071 CMOS sensor. Once Live View is active, the host loads a ~1.7 KB runtime control program into volatile camera RAM over a standard USB cable (zero firmware ROM edits; exiting or powering off restores the body completely), pausing the stock preview loop while keeping the mirror up and Nikon’s hardware thermistor overheat protection active.
With bus control handed over, the host dispatches on-demand commands (full-array reset, targeted row-band readout, full-frame readout, independent analog gain, and clean restore), which the camera main CPU forwards over SPI directly to Sony IMX071:
- Scan only the target band while other rows keep integrating: A windowed readout scans and digitizes only the addressed horizontal row range (~0.1 s readout), automatically resetting those rows to start their next exposure. Every unscanned row remains untouched across a sharp 1-row physical boundary and continues accumulating light linearly, with independent analog gain (ISO 100–3200) selectable per readout.
- Idle sleep suppresses glow: Between readouts, the sensor enters low-power sleep to avoid the heat and amplifier glow of continuous streaming.
- Lossless pixel readback: Captured pixels stream through the front-end into camera RAM and back to the host over the same USB cable (~86 ms binary transfer).
3. Swapping Live View Defaults for Still 14-bit Hardware Parameters
Running inside Live View’s open-shutter framework alone would still produce low-bit-depth frames. On takeover, the control program reuses the camera ROM’s built-in still-capture parameters across three hardware blocks:
- Timing generator (EI-155): Switches from the fast 29.0 µs preview line clock to the 35.0 µs precision still clock for full 14-bit ADC conversion;
- Image sensor (Sony IMX071): Switches from 10-bit preview mode to native 14-bit still mode (
MODE 0);
- Image front-end & DMA (EXPEED 2): Switches to
1.0× unity digital gain and lossless 16-bit Big-Endian RAM writes, bypassing the stock 12-bit truncation (measured ~15,800 ADU linear range, 0.89 ADU / ~2.6 e⁻ dark read noise at ISO 100).
On exit, all hardware parameters, interrupts, and RAM buffers are restored verbatim. Complete register maps, USB/SPI protocol definitions, and live benchmark comparisons are documented in docs/hardware-contract.md and docs/native-14bit-architecture.md.
Multi-Logical-Camera Software Stack
Beyond the 1.7 KB RAM timing payload, this repository ships complete host-side virtualization layers for both Windows (ASCOM Alpaca) and Linux (libusb-1.0 + INDI 2.0), splitting one USB-connected Nikon D5100 into two independently controllable logical cameras:
| Logical Device |
Default Output (Editable in build_payload.py) |
Exposure & Gain Control |
Typical Role |
Primary Band (camera/0 / FReLIT D5100 Main) |
4928 × 2912 native 14-bit RGGB (MaxADU = 16383) |
Independent long exposure (0.1 s–3600 s), independent analog gain, ROI subframe |
Deep-exposure / low-light imaging |
Secondary Band (camera/1 / FReLIT D5100 Guide) |
2464 × 240 2×2 binned mono (or 4928 × 240 native 14-bit RGGB via --raw-guide / FRELIT_RAW_GUIDE=1) |
Independent short exposure (0.1 s–10 s), independent analog gain, non-blocking readout |
Concurrent short-exposure / guiding / monitoring |
- Windows ASCOM Alpaca (
alpaca/VirtualCmosAlpaca.exe): Exposes standard ASCOM Alpaca ICameraV3 discovery (UDP 32227) and fast binary ImageBytes transfers. Any Alpaca-capable capture suite—such as N.I.N.A., SharpCap, ASCOM Diagnostics, or custom REST/Python clients—discovers both logical cameras automatically with zero custom plugins.
- Native Linux
libusb-1.0 + INDI Driver (indi/indi_frelit_d5100): Standalone C++17 USB PTP/MTP controller + multi-device INDI::CCD driver (FReLIT D5100 Main + FReLIT D5100 Guide, zero gphoto2 dependency). Drops directly into KStars/Ekos, PHD2, CCDciel, and open-source Linux astro boxes such as QHY QUARCS (verified on live Nikon D5100 + official QUARCS mobile App, concurrently capturing 14-bit main FITS and 0.5 s guider FITS over one USB cable). See indi/README.md.
- Standard FITS Workflow (
tools/capture_fits.py): Acquires synchronized frames from both logical cameras with zero third-party capture software dependencies, writing standard unsigned 16-bit FITS (BITPIX=16, BZERO=32768, BAYERPAT='RGGB') directly readable by Siril, PixInsight, ASTAP, and DS9.
- Configurable Band Partitioning: The default build ships a wide-primary / narrow-secondary reference layout; row-band start and height (
WIN_START, WIN_H) can be edited in firmware/build_payload.py to realize arbitrary ratios such as the 50% / 50% split demonstrated above.
Windows ASCOM Alpaca (2× speed): Two independent N.I.N.A. 3.2 instances connected to one stock Nikon D5100 over a single USB cable (50% / 50% split, 4928 × 1552 native 14-bit RGGB each). While the left instance integrates an unbroken 6.0 s exposure on the bottom half (revealing the full 180° 6 s clock wedge and continuous golden sweep), the right instance continuously loops 0.2 s exposures on the top half—delivering 3 independent crisp frames during the 6 s integration with zero disruption.
Linux Native INDI + Open-Source Astro Box: Official QHY QUARCS mobile app connected to a single stock Nikon D5100 via indi_frelit_d5100—recognizing and binding MainCamera: FReLIT D5100 Main and Guider: FReLIT D5100 Guide concurrently with zero changes to QUARCS source code.
Quick Start
Prerequisites: A stock Nikon D5100 running official Nikon firmware v1.01 (mode dial set to M, standard USB cable, no SD card or third-party camera drivers needed).
Requires Python 3 and built-in Windows .NET 4.0:
# 1. Build the runtime RAM payload (Python 3 stdlib only) and multi-camera Alpaca bridge
python firmware\build_payload.py
powershell -ExecutionPolicy Bypass -File alpaca\build.ps1
# 2a. Standalone FITS capture CLI (requires numpy: pip install -r requirements.txt)
python tools\capture_fits.py --auto-server --exp 2.0 --gain 100 --guide-count 2 --out captures
# 2b. Or launch the ASCOM Alpaca dual-camera server for N.I.N.A. / SharpCap / any Alpaca client
.\alpaca\bin\VirtualCmosAlpaca.exe
Linux (Native libusb-1.0 + INDI / QUARCS / Ekos)
# 1. Build the runtime RAM payload and native C++17 libusb + INDI driver
python3 firmware/build_payload.py
make -C indi && sudo make -C indi install
# 2. Install udev rule & INDI manifest (see indi/README.md for custom INDI_PREFIX)
sudo install -m 0644 indi/99-frelit-d5100.rules /etc/udev/rules.d/
sudo install -m 0644 indi/indi_frelit_d5100.xml /usr/share/indi/
sudo udevadm control --reload-rules && sudo udevadm trigger
# 3. Verify live silicon or launch under indiserver / KStars / QUARCS
./indi/d5100_libusb_test --live
indiserver -v indi_frelit_d5100
Press Ctrl+C (or disconnect all clients) to cleanly restore the D5100 to stock standby (lv=0).
Repository Structure
frelit-cmos/
├── firmware/ # Standalone assembler, deterministic 14-bit payload builder, and verified runtime binary
├── alpaca/ # Single-process Windows WPD USB bridge + ASCOM Alpaca ICameraV3 server & zero-SDK build script
├── indi/ # Native Linux libusb-1.0 PTP/MTP controller + INDI 2.0 dual-camera driver (KStars/Ekos/QUARCS)
├── tools/ # Zero-dependency native 14-bit FITS capture and inspection CLI
├── docs/ # Single-page hardware contract (hardware-contract.md), benchmark notes, and diagrams
├── tests/ # Offline unit tests (payload SHA-256 / FITS round-trip) and live dual-channel verifier (--mock / --live)
└── LICENSE # PolyForm Noncommercial License 1.0.0
python -m unittest discover -s tests -v # Offline unit tests (payload SHA-256 + FITS format)
python tests\verify_alpaca_live.py --mock # Offline ASCOM Alpaca + ImageBytes + UDP discovery check
python tests\verify_alpaca_live.py --live # Live Nikon D5100 concurrent dual-band + ROI + restore check
Scope & Roadmap
- Physical boundaries: Row-band destructive rolling readout (NOT non-destructive readout / NDR)—reading a row band resets that band’s photodiodes; matches factory 14-bit Still NEF hardware black-level subtraction (~600 ADU); currently verified on stock Nikon D5100
v1.01b only (enforces an exact firmware fingerprint check before touching memory).
- Roadmap: Runtime-parameterized row-band coordinates (dynamic split ratios without rebuilding payload); optional unclipped positive black-level pedestal toggle; hardware profile generalization to sibling Sony IMX071 / EXPEED 2 bodies (e.g., Nikon D7000).
Safety & License
- Non-destructive & clean-room: The control program resides strictly in volatile camera RAM and restores the body 100% to stock on exit or power-off while keeping hardware thermistor overheat protection active. No proprietary Nikon firmware binaries are redistributed.
- Non-Commercial Research License: Released under the PolyForm Noncommercial License 1.0.0 (
PolyForm-Noncommercial-1.0.0) strictly for non-commercial scientific research, academic study, and personal hardware-timing experimentation. Commercial use is not permitted under this license. Provided “as is”, without warranty of any kind (including third-party patent clearance or non-infringement).
Required Notice: Copyright (c) 2026 Narrowcat (https://github.com/Narrowcat/FReLIT-CMOS)
- Acknowledgments: Grateful to early Nikon Hacker community contributors for public IMX071 register and Nikon PTP service documentation, and to the ASCOM Alpaca open interface community.
评论