Skip to content

fix(examples): use correct EtherCAT configured station address in ethercat-real-bus#9

Merged
patdhlk merged 2 commits into
mainfrom
fix/ethercat-real-bus-subdev-address
May 22, 2026
Merged

fix(examples): use correct EtherCAT configured station address in ethercat-real-bus#9
patdhlk merged 2 commits into
mainfrom
fix/ethercat-real-bus-subdev-address

Conversation

@patdhlk
Copy link
Copy Markdown
Owner

@patdhlk patdhlk commented May 22, 2026

Summary

  • Fix `SUBDEV` in `examples/ethercat-real-bus` from `1` to `0x1001` — the `EthercrabBusDriver::with_subdevice_inputs` match key is `sd.configured_address()`, which `ethercrab`'s `init_single_group` auto-assigns starting at `0x1000`, not the 0-based topology index. The old value matched no SubDevice on a real EK1100 + EL1008 rig, so the reader silently yielded zero envelopes.
  • Update the module docs, the routing comment, and the README's "Topology assumption" section to describe configured station addresses (`0x1000` + topology offset) so the next reader doesn't trip on the same gap.

Why this slipped past PR #8

The example was written to spec from doc reading without a live rig. The reasonable-looking "EK1100 = SubDevice 0, EL1008 = SubDevice 1" assumption maps to ethercrab's bus-scan topology index, but the driver's lookup uses the EtherCAT configured station address — a different namespace. The connector silently returns `None` when nothing matches, which presents as "stream healthy, value always 0" rather than an error. Diagnosed on a Pi 5 by counting envelopes-per-tick and confirming the bus reached OP.

Test plan

  • `cd examples/ethercat-real-bus && cargo check` on Mac (no `bus-integration` feature) — passes
  • Native build on Raspberry Pi 5 (`cargo build --release`) — passes
  • Run against real bus (EK1100 + EL1008 + EL2004 + EL9011, NIC up but no IP, `cap_net_raw,cap_net_admin=eip`) — reader now produces `bits=0b…` lines as the README predicts (verified `0b00000000` with nothing wired, which is the expected reading)
  • No new clippy / fmt / doc warnings (pre-commit + pre-push hooks pass)

patdhlk added 2 commits May 22, 2026 10:22
…ercat-real-bus

`EthercrabBusDriver::with_subdevice_inputs` matches on
`sd.configured_address()`, which `ethercrab`'s `init_single_group`
auto-assigns starting at `0x1000` — not on the 0-based topology
index. The example was pinned to `SUBDEV: u16 = 1`, which matched
no SubDevice on a real EK1100 + EL1008 rig, so the reader silently
yielded zero envelopes.

Bump the const to `0x1001` and update the module docs, the routing
comment, and the README's "Topology assumption" section to describe
configured station addresses so the next person doesn't trip on
the same gap.

Verified live on a Raspberry Pi 5 against an EK1100 + EL1008 +
EL2004 — envelopes now flow at the expected ~1/cycle (10 ms tick),
and toggling inputs produces `bits=…` lines as the README predicts.
…l capture

The "What you should see" block was written from doc-reading, with
illustrative timestamps and bit patterns that didn't reflect what
the binary actually emits. Replace it with a trimmed transcript of
a real Pi 5 session: bring-up, the iceoryx2 default-config warning,
the first all-zeros sample, the Connecting → Up → Degraded health
flow, and a walking-bit pattern from probing each EL1008 input in
turn (verifies all 8 channels end-to-end).

Also explain when readers should expect Up → Degraded — it's tied
to having an extra output terminal (the captured rig had an EL2004)
not being written to, which is asymmetric-PDO behaviour the
connector intentionally flags. With the bare topology this README
documents, the transition does not appear.
@patdhlk patdhlk merged commit fb61f2f into main May 22, 2026
41 of 42 checks passed
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