Skip to content

RxPDO not working - slave.input is read-only, slave.output has zero length #188

@maihongda1989

Description

@maihongda1989

Title: RxPDO not working for Digital Output modules - slave.input is read-only, slave.output has zero length


Environment

  • PySOEM Version: 1.1.12
  • Python: 3.12.7
  • OS: Windows 10/11
  • Device: Leadshine EM32DO-E4 (32-bit Digital Output Module)

Problem

Cannot write to digital output modules via PDO. The device has proper RxPDO mapping in ESI, but:

  1. slave.input - 4 bytes but read-only (no setter)
  2. slave.output - 0 bytes (not allocated)
do_slave = master.slaves[1]  # EM32DO-E4

# After config_map()
print(len(do_slave.input))   # 4 bytes
print(len(do_slave.output))  # 0 bytes ❌

# Try to write
do_slave.input = b'\xFF\xFF\xFF\xFF'
# AttributeError: property 'input' of 'CdefSlave' object has no setter ❌

Expected Behavior

Based on your basic_example.py (Beckhoff EL1259):

self._master.slaves[2].output = bytes(tmp)  # Should work

Device Configuration

ESI file has correct RxPDO:

<RxPdo Mandatory="true" Fixed="true" Sm="2">
    <Index>#x1600</Index>
    <Entry>
        <Index>#x7000</Index>
        <SubIndex>1</SubIndex>
        <BitLen>16</BitLen>
    </Entry>
    <Entry>
        <Index>#x7000</Index>
        <SubIndex>2</SubIndex>
        <BitLen>16</BitLen>
    </Entry>
</RxPdo>

<Sm StartAddress="#x1800" ControlByte="#x64" Enable="1">Outputs</Sm>

Current Workaround

Only SDO works (non-realtime, ~10Hz):

do_slave.sdo_write(0x7000, 1, struct.pack('<I', value))

Diagnostic Output

=== Slave 1: EM32DO-E4 ===
input buffer (RxPDO: Master→Slave):
   Type:   bytes
   Length: 4 bytes
   Content: 00000000
   Writability test:
      [FAIL] slave.input cannot be assigned: property 'input' of 'CdefSlave' object has no setter

output buffer (TxPDO: Slave→Master):
   Type:   bytes
   Length: 0 bytes
   Writability test:
      - Length is 0, cannot test

Available methods:
   - _get_input
   - _get_output
   - _set_output
   - input
   - output

Comparison

DI Module (EM32DI-E4) - Works perfectly:

input buffer: 0 bytes
output buffer: 4 bytes ✓
slave.output = b'...'  # Works! ✓

Questions

  1. Why is slave.output not allocated for devices with RxPDO?
  2. Should slave.input have a setter for RxPDO devices?
  3. Is there a _set_output() or similar method we should use?

Suggested Fix

One of:

  1. Add setter for slave.input property
  2. Allocate slave.output buffer for RxPDO devices
  3. Provide write_output_pdo(data) method
  4. Document the correct approach if we're doing it wrong

Full Diagnostic Script

Can provide complete test script and ESI files if needed.

This blocks real-time digital output control for many industrial devices.

Thank you for this great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions