Skip to content

Add LimeSDR support via WebUSB and LMS7002M driver#12

Draft
jLynx wants to merge 5 commits into
mainfrom
lime_sdr
Draft

Add LimeSDR support via WebUSB and LMS7002M driver#12
jLynx wants to merge 5 commits into
mainfrom
lime_sdr

Conversation

@jLynx
Copy link
Copy Markdown
Owner

@jLynx jLynx commented Apr 1, 2026

Description

This PR introduces native support for LimeSDR devices (USB, Mini, and Mini v2) using the WebUSB API. It includes a from-scratch implementation of the LMS64C protocol and LMS7002M transceiver configuration, enabling high-bandwidth SDR capabilities directly in the browser.

Key Changes

1. LimeSDR Driver Implementation

  • LMS64C Protocol: Added a protocol layer to handle command packets, SPI reads/writes, and FPGA register access over USB bulk endpoints.
  • LMS7002M Control: Implemented chip initialization, including:
    • CGEN & SX PLL Tuning: Automatic VCO selection and CSW (Capacitor Switch) sweeping to ensure frequency locks.
    • Analog Frontend (RFE/RBB): Support for manual gain control (LNA, TIA, PGA) and antenna path switching (LNAW, LNAL, LNAH).
    • Digital Signal Processing: Configuration of the RXTSP for DC offset correction to eliminate the "DC spike" at the center frequency.
  • FPGA Gateware Sync: Added logic to configure FPGA PLLs for phase-aligned DDR data capture, matching LimeSuite's timing calculations.

2. Streaming & Performance

  • SISO DDR Mode: Configured the device for Single-Input Single-Output Double Data Rate mode to maximize bandwidth for a single channel.
  • Optimized Buffering: Implemented a multi-threaded transfer loop using 8 concurrent USB requests with 256KB buffers (matching HackRF logic) to prevent dropped samples at high sample rates (up to 30 MSPS).
  • Sample Conversion: Optimized the conversion of 12-bit wire samples to 8-bit integers by using a 4-bit right shift to preserve maximum dynamic range.

3. UI & Framework Enhancements

  • New Control Type: Added select type to the GainControl interface to support labeled dropdowns (used for Antenna selection).
  • Spectrum Smoothing: Refactored the FFT throttling logic in rx-stream.ts from frame-skipping to time-based intervals (performance.now()) to ensure a consistent 20 FPS waterfall across different device callback rates.
  • Audio Pipeline: Removed the audio batch threshold in the mixer to allow smoother playback for devices that emit larger, less frequent USB packets.

Supported Hardware

  • LimeSDR-USB (VID: 0x04B4, PID: 0x00F1)
  • LimeSDR-Mini / v2 (VID: 0x1D50, PID: 0x6108)

Verified Functionality

  • Device detection and WebUSB claiming.
  • Frequency tuning across HF/VHF/UHF ranges.
  • Successful VCO locking on CGEN and SXR.
  • Sample rates tested up to 30 MSPS without overflow.
  • Manual gain and antenna switching.

jLynx added 5 commits April 1, 2026 11:05
- Introduced new interfaces: USBConfiguration, USBInterface, USBAlternateInterface, and USBEndpoint to enhance USB device handling.
- Added transferOut method to USBDevice interface for improved data transfer capabilities.
- Updated backend.ts to include LimeSDR device support.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
browsdr e28be37 Commit Preview URL

Branch Preview URL
Apr 01 2026, 08:16 AM

@jLynx jLynx changed the title LimeSDR Support Add LimeSDR support via WebUSB and LMS7002M driver Apr 1, 2026
@jLynx
Copy link
Copy Markdown
Owner Author

jLynx commented Apr 1, 2026

It kind of works, but having reflection issues and issues where the frequencies dont quite match up

@doubleailes doubleailes mentioned this pull request Apr 15, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant