Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDO data size truncated to length of the default value in the EDS #135

Closed
iurly opened this issue Jan 14, 2019 · 6 comments
Closed

SDO data size truncated to length of the default value in the EDS #135

iurly opened this issue Jan 14, 2019 · 6 comments
Milestone

Comments

@iurly
Copy link

iurly commented Jan 14, 2019

When trying to read (download) string SDOs from a node, the value returned by .raw is truncated to the length of the value contained in the EDS, even though the node returns a longer value.

For instance, if I have:

[100A]
ParameterName=Manufacturer_software_version
ObjectType=0x7
;StorageLocation=RAM
DataType=0x0009
AccessType=const
DefaultValue=3.00
PDOMapping=0

when trying to read node.sdo[0x100a].raw

  • Up to version 0.6.0, I would get the whole string
  • From version 0.7.0 onwards, I would get it truncated to the first 4 characters (length of default value 3.00), even though everything looks correct on the wire.
    This is probably related to PDO and SDO expected and actual data size #64.

Am I doing something wrong?

@iurly
Copy link
Author

iurly commented Jan 14, 2019

Actually it looks there is a bug on the node firmware:

  can0  615   [8]  40 0A 10 00 00 00 00 00
  can0  595   [8]  41 0A 10 00 04 00 00 00
  can0  615   [8]  60 00 00 00 00 00 00 00
  can0  595   [8]  00 61 63 63 6D 69 63 2D
  can0  615   [8]  70 00 00 00 00 00 00 00
  can0  595   [8]  15 30 2E 35 2E 31 00 00

Which plainly indicates "4" as its data size.
Is there any way to work around that?

@iurly iurly closed this as completed Jan 14, 2019
@iurly iurly reopened this Jan 14, 2019
@christiansandberg
Copy link
Owner

I’m not sure how to handle that situation. CANopen is a bit weird in the sense that the size is specified twice. Both for the whole data and for each segment. What happens if they differ? Which one takes precedence?

@iurly
Copy link
Author

iurly commented Jan 14, 2019

I totally agree and I don't have an answer to your question. :-(
Point is, software that was working before (perhaps by mistake) is now broken after upgrading and for some reason I'm not able to install the old version.
If such an inconsistency exists, perhaps a global setting could be used to resolve this.
At any rate, could you point out what the affected code area is, so that I can at least monkey-patch it for now?

@iurly
Copy link
Author

iurly commented Jan 14, 2019

FWIW, CANopenNode implementation apparently gives precedence to the actual transfer size (thereby ignoring the actual value reported in the first packet), contrary to what python-canopen (this package) does starting from v.0.7.0.
Using that implementation as the SDO client (as well as the SDO server, which is the one with the issue right now), I never noticed that bug.

@iurly
Copy link
Author

iurly commented Mar 6, 2019

Hi @christiansandberg, are you planning on making a new release with this change included, any time soon?

@christiansandberg christiansandberg added this to the v0.8.1 milestone Mar 6, 2019
@christiansandberg
Copy link
Owner

v0.8.1 is now uploaded to PyPI.

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

No branches or pull requests

2 participants