Using pysoem (C lib SOEM wrapper for python), I'm having few issues. Github issue link with more details
- Trying to get Object Dictionary
od=slave.odraises pysoem.SdoInfoError - reading SDO - CoE object (CANopen over EtherCAT)
sdo = master.slaves[0].sdo_read(0x6060, 0)
print(f'6040 = {sdo}')
sdo_decode = struct.unpack('<'+'I' * (len(sdo) // 4), sdo)
# sdo_decode = struct.unpack('I', sdo) # Raising error: unpack requires a buffer of 4 bytes
print(f'6040 decode:\n {sdo_decode}')
Outputs Binary code
6040 = b'\xd82B:\xeb\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\...........
6040 decode:
(977416920, 491, 0, 0, 2938031584, 35, 974847760, 491, 967825216, 491, 3981134032, 32767, 977416920, 491, 0, 0, 2938031584, 35, 974847760, 491, 933193056, 491, 1, 0, 871235840, 491, 977416256, 491, 0, 0, 0, 0, 871235584, 491, 0, 0, 977273952, 491, ........... )
- how to get Object Dictionary properly ?
- What do I do with this Binary Ethernet Frame ? is accessing the Frame bit-wise the proper way to deal with this ? if so, are there any libraries for this ?
So far my conclusion is that I need to struct.unpack('parameters',SDO) with the correct parameters for each SDO type ?
Thank you.
Trying to decode the SDO message, was expecting something readable. Trying to find the right parameters to unpack the SDO message, stuck at researching on how to handle SDO's.