feat: spec-conformant IO-Link wire (startup 0xA2, DeviceOperate 0x99, ISDU Table A.12) - #21
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the device stack speak the V1.1.5-conformant wire, replacing three co-designed shortcuts. Coordinated with the sibling
iolinki-masterchange (its PR lands after labwired-core bumps this pin — see below).Wire changes (per IO-Link Interface & System Spec V1.1.5)
MC = 0xA2(read, page channel, addr 0x02 = MinCycleTime). Newdll_handle_page_channel_read()answers it from the Direct Parameter page (iolink_isdu_direct_param_page1_octet()). (Was: MC0x00, routed into ISDU.)0x99"DeviceOperate" (Table B.2) written to Direct Parameter addr0x00on the page channel: a 3-octet Type-0 WRITE[MC 0x20, OD 0x99, crc6]. Newiolink_frame_encode_type0_write(); the PREOPERATE dispatch accepts it → ESTAB_COM. Legacy0x0Fretained. (AddedIOLINK_CMD_DEVICE_OPERATE.)0x0B, write0x03(protocol.hIOLINK_ISDU_SERVICE_READ/WRITE;isdu.cdecode). (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.
-Wall -Wextraclean).Bonus fix
Once ISDU writes worked conformantly,
test_03_factory_restore_0x82exposed a pre-existing device bug: Restore Factory Settings reset the legacy global param set, not the per-device context bound byiolink_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'stest_master_real_iolinki_device.