Skip to content

Conversation

@acolomb
Copy link
Member

@acolomb acolomb commented Apr 17, 2024

The maximum size of a PDO is 64 bits = 0x40. Any higher value is per definition invalid, so the highest bit is definitely unused.

This prompted at least one device manufacturer (miControl GmbH) to utilize this bit for their own purpose. They state in their manual that the device supports only the following lengths: 8 (0x08), 16 (0x10), 32 (0x20) bits. However, the device allows setting the highest bit as well, to indicate the mapping concerns a signed variable. This triggers the appropriate sign bit padding when receiving the value, as all internal variable accesses are handled as INTEGER32.

When such a PDO mapping is read in, the total PDO size calculation in the canopen library fails badly. Thus the easy fix is to just always mask out that highest bit, which is never a meaningful part of the length field.

The maximum size of a PDO is 64 bits = 0x40.  Any higher value is per
definition invalid, so the highest bit is definitely unused.

This prompted at least one device manufacturer (miControl GmbH) to
utilize this bit for their own purpose.  They state in their manual
that the device supports only the following lengths: 8 (0x08),
16 (0x10), 32 (0x20) bits.  However, the device allows setting the
highest bit as well, to indicate the mapping concerns a signed
variable.  This triggers the appropriate sign bit padding when
receiving the value, as all internal variable accesses are handled as
INTEGER32.

When such a PDO mapping is read in, the total PDO size calculation in
the canopen library fails badly.  Thus the easy fix is to just always
mask out that highest bit, which is never a meaningful part of the
length field.
@acolomb
Copy link
Member Author

acolomb commented Apr 17, 2024

Unfortunately I have no reference from miControl on this, it can only be noticed from their mPLC / mcTools parameterization software.

@christiansandberg christiansandberg merged commit 713f005 into canopen-python:master Apr 21, 2024
@acolomb acolomb deleted the ignore-pdo-mapping-length-msb branch April 22, 2024 08:53
jonastittmannpinion pushed a commit to PinionGmbH/canopen that referenced this pull request Apr 30, 2024
@acolomb acolomb added this to the v2.3.0 milestone Jun 11, 2024
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.

2 participants