Skip to content

[Bug] I2C Bus Corruption with SD Card Inserted (Lightware LW20/C) #26483

@mgardenswartz

Description

@mgardenswartz

Describe the bug

Hardware Configuration:

  • Flight Controller: CubePilot Blue
  • Carrier Board: Standard ADS-B Carrier Board
  • Firmware: PX4 v1.16.0 (Also confirmed on v1.15.0)
  • Sensor: Lightware LW20/C (Firmware v4.4.3)
  • Repeatability: 3 identical units verified exhibiting same behavior.

Issue 1: I2C Bus Corruption tied to SD Card Activity

The Lightware LW20/C (connected via I2C) exhibits severe data corruption when the MicroSD card is inserted.

Symptoms:

  • min_distance toggles between 20 (valid) and 0.
  • max_distance toggles between 10000 (valid) and 34364 (garbage).
  • id toggles between 0 (valid) and 1 (garbage).
  • current_distance flickers between an accurate measurement in centimeters and 20 (garbage)
  • signal_quality spikes to 100 synchronously with garbage data.
  • horizontal_fov flickers between 0 (valid) and 0.399902 (garbage).
  • vertical_fov flickers between 0 (valid) and 0.399902 (garbage).

Reproduction Steps:

  1. Connect LW20/C to I2C2 (as labeled on standard carrier).
  2. Set SENS_EN_SF1XX to 6 (LW20/c).
  3. Boot with SD Card Inserted: Data is unusable (flickering/garbage).
  4. Boot with SD Card Removed: Data is perfect/stable.

Issue 2: UART Driver Protocol Mismatch (Secondary Issue) Attempting to switch to UART to mitigate the I2C noise results in a "Communication Error" loop.

Setup:

  • Wiring: RX-to-TX and TX-to-RX (Verified).
  • Baud: 115200 (Matched on Sensor and PX4).
  • Params: SENS_SF0X_CFG = TELEM1 (or GPS1 or TELEM2, I tried each).

Symptoms:

  • lightware_laser_serial status shows com_err count equal to read count (e.g., 429 reads, 429 errors). The number "429" is not consistent, but the number of reads always matches the number of com_errs.

This suggests the driver is receiving data but failing to parse the packets (like a Binary vs. ASCII protocol mismatch, but sf0x driver lacks a parameter to force the parsing mode). No setting in Lightware Studio appears to set the parsing mode.

Documentation Discrepancy:

The PX4 documentation for Cube Orange/Standard Carrier (here: https://docs.px4.io/main/en/flight_controller/cubepilot_cube_orange) incorrectly maps the I2C ports. On the physical board, the port labeled GPS1 is I2C1, and GPS2 is I2C2. (Source that matches real world observations: https://docs.cubepilot.org/user-guides/carrier-boards/cube-red-standard-carrier-board-pinout)

Troubleshooting Attempted:

  • Moving between I2C1 and I2C2 (No change).
  • Changing I2C bus frequency (No change).
  • Replacing sensors and cables (No change).
  • Only removing the SD card resolves the I2C issue.

Flight Log / Additional Information

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions