Skip to content

feat: spec-conformant IO-Link wire (startup 0xA2, DeviceOperate 0x99, ISDU Table A.12) - #21

Merged
w1ne merged 4 commits into
developfrom
feat/spec-conformant-wire
Jul 4, 2026
Merged

feat: spec-conformant IO-Link wire (startup 0xA2, DeviceOperate 0x99, ISDU Table A.12)#21
w1ne merged 4 commits into
developfrom
feat/spec-conformant-wire

Conversation

@w1ne

@w1ne w1ne commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Makes the device stack speak the V1.1.5-conformant wire, replacing three co-designed shortcuts. Coordinated with the sibling iolinki-master change (its PR lands after labwired-core bumps this pin — see below).

Wire changes (per IO-Link Interface & System Spec V1.1.5)

  • Startup probe — the master now sends a Type-0 READ MC = 0xA2 (read, page channel, addr 0x02 = MinCycleTime). New dll_handle_page_channel_read() answers it from the Direct Parameter page (iolink_isdu_direct_param_page1_octet()). (Was: MC 0x00, routed into ISDU.)
  • OPERATE transition — MasterCommand 0x99 "DeviceOperate" (Table B.2) written to Direct Parameter addr 0x00 on the page channel: a 3-octet Type-0 WRITE [MC 0x20, OD 0x99, crc6]. New iolink_frame_encode_type0_write(); the PREOPERATE dispatch accepts it → ESTAB_COM. Legacy 0x0F retained. (Added IOLINK_CMD_DEVICE_OPERATE.)
  • ISDU I-Service nibble — Table A.12 (16-bit Index+Subindex): read 0x0B, write 0x03 (protocol.h IOLINK_ISDU_SERVICE_READ/WRITE; isdu.c decode). (Was: 0x08/0x09.)

Test infrastructure — now certifies real V1.1.5

The C tests, the Python virtual master, and the 49-test conformance suite were all emitting the old octets; they're updated to the conformant wire.

  • C tests: 23/23 pass (-Wall -Wextra clean).
  • Conformance suite: 49/49 pass (127 s).

Bonus fix

Once ISDU writes worked conformantly, test_03_factory_restore_0x82 exposed a pre-existing device bug: Restore Factory Settings reset the legacy global param set, not the per-device context bound by iolink_device_init, so an application tag survived a factory restore. Routed the reset through the bound context.

Verified interop with the conformant master in-process via iolinki-master's test_master_real_iolinki_device.

w1ne added 3 commits July 5, 2026 00:48
protocol.h IOLINK_ISDU_SERVICE_READ 0x08->0x0B, WRITE 0x09->0x03 (16-bit
Index+Subindex form). isdu.c decoder accepts the spec nibbles. Pairs with
the iolinki-master encode change; verified via the master's
test_master_real_iolinki_device. Device-repo C tests + virtual master +
conformance suite still need updating (follow-up).
Make the device DLL agree with the master on the V1.1.5 startup wire.

- Startup probe (transition T1): in STARTUP/AWAITING_COMM, answer the first
  page-channel Type-0 READ (MC 0xA2) with the requested Direct Parameter page 1
  octet (address 0x02 -> MinCycleTime) instead of feeding the MC into ISDU, then
  advance to PREOPERATE. Only the first post-wake frame is treated as the probe,
  so later PREOPERATE ISDU traffic is unaffected.
- OPERATE transition: accept a Type-0 page-channel WRITE of MasterCommand
  DeviceOperate (0x99) to Direct Parameter address 0x00 (MC 0x20, 3-octet frame)
  to establish communication. The legacy 0x0F transition path is retained.
- Add iolink_frame_encode_type0_write() for the 3-octet write frame and
  iolink_isdu_direct_param_page1_octet() to source the probe reply.
- Add IOLINK_CMD_DEVICE_OPERATE (0x99).
The device stack now speaks the V1.1.5-conformant wire, but the test
infrastructure still emitted the old co-designed octets. Update all of it
to the conformant framing so the C suite and the 49-test conformance suite
pass end to end.

- C tests: ISDU request headers now use the I-Service nibbles from
  Table A.12 (read 0xB0, write 0x3X / 0x3F extended) in test_helpers,
  test_isdu_segmented and test_isdu_stress.
- Virtual master: startup probe is a Type-0 page-channel read (MC 0xA2,
  MinCycleTime); DeviceOperate transition is a Type-0 write (MC 0x20 +
  OD 0x99 + CRC6); ISDU read/write use the conformant service nibbles.
- Conformance suite: correct the state-machine and error-injection notes
  to the DeviceOperate octets.

Also fix a latent device defect exposed once ISDU writes complete on the
conformant wire: the Restore Factory Settings / Restore Application
Defaults commands reset the legacy global parameter set instead of the
device's bound context, so a per-device application tag survived a factory
restore. Route the reset through the bound params context.
@w1ne
w1ne merged commit 705935d into develop Jul 4, 2026
3 checks passed
@w1ne
w1ne deleted the feat/spec-conformant-wire branch July 5, 2026 00:00
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