Skip to content

common: benewake: document I2C connection, fix TF-Luna range - #8012

Merged
Hwurzburg merged 1 commit into
ArduPilot:masterfrom
Hwurzburg:benewake-i2c-connection
Sep 4, 2026
Merged

common: benewake: document I2C connection, fix TF-Luna range#8012
Hwurzburg merged 1 commit into
ArduPilot:masterfrom
Hwurzburg:benewake-i2c-connection

Conversation

@Hwurzburg

@Hwurzburg Hwurzburg commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #7949, reported by @Strohtho.

The page described these lidar as serial and CAN only - "proprietary serial and/or CAN interfaces", with every Interface column entry reading UART or CAN. In fact every model on the page except the TF03 and TF350 can be connected over I2C, and ArduPilot has had drivers for that the whole time.

Two drivers involved

  • TFS20-L has its own: RNGFND1_TYPE = 46 (BenewakeTFS20L). This was documented nowhere on the wiki. Worse, the page's serial section told TFS20-L owners to set type 27, which is the TF03 serial driver.
  • The rest share the TFmini Plus I2C command protocol (the 0x5A command frames in AP_RangeFinder_Benewake_TFMiniPlus.cpp) and use RNGFND1_TYPE = 25 (BenewakeTFmini-I2C). This is what @Strohtho found working on a TF-Luna.

Both are AP_RangeFinder_Backend_I2C subclasses defaulting to address 0x10.

Changes

  • New "Connecting via I2C" section between the serial and CAN sections
  • Interface column marks I2C on TF02, TF02-Pro, TF02-i, TFS20-L, TF-Luna and TF-Nova; TF03 and TF350 are unchanged as UART, CAN
  • Opening sentence mentions I2C

One thing deliberately not copied from the issue

The report lists RNGFND1_PIN, RNGFND1_RMETRIC, RNGFND1_SCALING and RNGFND1_STOP_PIN alongside the settings that worked. Those are analog-only - ratiometric and scaling are read in AP_RangeFinder_analog.cpp and neither I2C backend references them. Rather than documenting them as required, the section carries a note saying they do not apply to an I2C connection.

Parameter names and the type codes 25 and 46 were checked against a generated apm.pdef.xml, which is also where the exact GCS string BenewakeTFmini-I2C comes from.

Also: TF-Luna range corrected

The table gave the TF-Luna as 0.80m / 3m. Benewake specify "0.2 ~ 8 m" - the old figures look like the accuracy specification ("± 6 cm @ (0.2 ~ 3 m)") mistaken for the detection range. Corrected to 0.20m / 8m. It is in the same table row this PR already edits, so it is folded in here rather than raised separately.

That same product page lists the TF-Luna's interfaces as "UART, I/O, I²C", which independently confirms the I2C support documented above.

Built with python3 update.py --fast --site copter.

🤖 Generated with Claude Code

@Hwurzburg
Hwurzburg force-pushed the benewake-i2c-connection branch from c6b2b08 to c28b898 Compare August 29, 2026 13:17
@Hwurzburg Hwurzburg changed the title common: benewake: document I2C connection common: benewake: document I2C connection, fix TF-Luna range Aug 29, 2026
@Hwurzburg
Hwurzburg requested a review from rmackay9 September 2, 2026 23:34
rmackay9
rmackay9 previously approved these changes Sep 3, 2026

@rmackay9 rmackay9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we would have wiring diagrams for at least one of the lidars capable of I2C but in any case this is an improvement, thanks!

The page presented these lidar as serial and CAN only, so there was no
route to the I2C option for any of them. Every model on the page except
the TF03 and TF350 supports I2C.

Add a Connecting via I2C section, mark I2C in the interface table for the
models that have it, and note I2C in the opening sentence.

Two drivers are involved. The TFS20-L has its own, RNGFND1_TYPE = 46
(BenewakeTFS20L), which was not documented anywhere on the wiki - the
page told TFS20-L users to set type 27, the TF03 serial driver. The rest
share the TFmini Plus I2C command protocol and use RNGFND1_TYPE = 25
(BenewakeTFmini-I2C). Both default to I2C address 0x10.

Also note that RNGFND1_PIN, RNGFND1_RMETRIC, RNGFND1_SCALING and
RNGFND1_STOP_PIN apply only to analog rangefinders. The issue reporter
listed them alongside the working settings, but they are not read by
either I2C backend.

Correct the TF-Luna's range, which was given as 0.80m / 3m. Benewake
specify 0.2 ~ 8m; the old figures look like the accuracy specification
(+/-6cm @ 0.2 ~ 3m) mistaken for the detection range.

Fixes ArduPilot#7949

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Hwurzburg

Copy link
Copy Markdown
Contributor Author

Ideally we would have wiring diagrams for at least one of the lidars capable of I2C but in any case this is an improvement, thanks!

added

@Hwurzburg
Hwurzburg merged commit a533c4d into ArduPilot:master Sep 4, 2026
4 checks passed
@Hwurzburg
Hwurzburg deleted the benewake-i2c-connection branch September 4, 2026 14:37
@rmackay9

rmackay9 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Benewake TF02-Pro / TF03 / TFS20-L / TF-Luna / TF-Nova / TF350

2 participants