Prerequisites
Expected Behavior
- When parsing composite custom data types defined in ESI XML, extract each field according to its configured
BitOffs and BitSize instead of reading the entire buffer as a single integer value.
- Apply two's complement sign conversion for fields marked as
SINT (8-bit signed integer). For byte 0xFD, the parsed value should be -3.
- Ignore unused padding bits inside composite structures.
Current Behavior
- The parser does not respect
BitOffs field offsets for composite structures. It parses the whole 32-bit hex buffer into one unsigned integer directly, unable to split discrete fields at non-contiguous bit positions.
SINT signed 8-bit variables are parsed as unsigned bytes without sign compensation, producing incorrect large positive values.
- This parsing error breaks any CANopen object that uses this irregular composite structure definition.
Steps to Reproduce
- Import ESI file KS100E_Ecat_V2.1.xml which contains composite DataType with scattered BitOffs.
- Read the hex default value
FFFFFFFD of the composite-type object.
- Check the resolved value of the
SINT subfield located at BitOffs=24.
Key ESI DataType definition
<DataType>
<Name>DT60C2</Name>
<BitSize>32</BitSize>
<SubItem>
<SubIdx>0</SubIdx>
<Name>largest sub-index supported</Name>
<Type>USINT</Type>
<BitSize>8</BitSize>
<BitOffs>0</BitOffs>
</SubItem>
<SubItem>
<SubIdx>1</SubIdx>
<Name>Interpolation time period value</Name>
<Type>USINT</Type>
<BitSize>8</BitSize>
<BitOffs>16</BitOffs>
</SubItem>
<SubItem>
<SubIdx>2</SubIdx>
<Name>Interpolation time index</Name>
<Type>SINT</Type>
<BitSize>8</BitSize>
<BitOffs>24</BitOffs>
</SubItem>
</DataType>
DefaultData
<Object>
<Index>#x60c2</Index>
<Name>Interpolation time period</Name>
<Type>DT60C2</Type>
<BitSize>32</BitSize>
<Info>
<SubItem>
<Name>largest sub-index supported</Name>
<Info>
<DefaultData>02</DefaultData>
</Info>
</SubItem>
<SubItem>
<Name>Interpolation time period value</Name>
<Info>
<DefaultData>01000000</DefaultData>
</Info>
</SubItem>
<SubItem>
<Name>Interpolation time index</Name>
<Info>
<DefaultData>FFFFFFFD</DefaultData>
</Info>
</SubItem>
</Info>
<Flags>
<Access>rw</Access>
<Category>o</Category>
</Flags>
</Object>
Possible Solution
- Rewrite composite type parsing logic to slice binary data per
BitOffs + BitSize for each sub-item.
- Add signed value conversion logic for the
SINT data type.
- Skip unused padding bits between structure members.
Context
The lack of proper BitOffs parsing compatibility limits support for vendor-specific CANopen ESI object definitions with non-contiguous structure layout, leading to wrong parameter readings for servo drive configuration.
Prerequisites
Expected Behavior
BitOffsandBitSizeinstead of reading the entire buffer as a single integer value.SINT(8-bit signed integer). For byte0xFD, the parsed value should be-3.Current Behavior
BitOffsfield offsets for composite structures. It parses the whole 32-bit hex buffer into one unsigned integer directly, unable to split discrete fields at non-contiguous bit positions.SINTsigned 8-bit variables are parsed as unsigned bytes without sign compensation, producing incorrect large positive values.Steps to Reproduce
FFFFFFFDof the composite-type object.SINTsubfield located atBitOffs=24.Key ESI DataType definition
DefaultData
Possible Solution
BitOffs+BitSizefor each sub-item.SINTdata type.Context
The lack of proper
BitOffsparsing compatibility limits support for vendor-specific CANopen ESI object definitions with non-contiguous structure layout, leading to wrong parameter readings for servo drive configuration.