Difference between revisions of "SimpleMotion V2 subpacket types"
From Granite Devices Knowledge Wiki
(Created page with "==Outbound subpacket types== All actions (commands) to target devices are done by atomic operations defined by outbound subpackets. Subpackets are trasnferred to drive with in...") |
(No difference)
|
Latest revision as of 19:37, 1 September 2015
Contents
Outbound subpacket types[edit | edit source]
All actions (commands) to target devices are done by atomic operations defined by outbound subpackets. Subpackets are trasnferred to drive with instant commands or buffered commands. Possible outbould subpacket types and their parameters are following:
- SM_SET_WRITE_ADDRESS
- Parameter sets the SMP parameter address that will be accessed in the subsequenty read/write commands. Consumes 2 bytes from payload.
- SM_WRITE_VALUE_24B
- Parameter writes value to parameter address defined earlier by SM_SET_WRITE_ADDRESS, parameter value lenght is 22 bits (bits above 22 are set zero). Consumes 3 bytes from payload buffer.
- SM_WRITE_VALUE_30B
- Parameter writes value to parameter address defined earlier by SM_SET_WRITE_ADDRESS, parameter value lenght is 30 bits (bits above 30 are set zero). Consumes 4 bytes from payload buffer.
Inbound subpacket types[edit | edit source]
Each data reception from target devie will be formed of following subpackets. The type and address whic subpackets are being returned are defined by parameters SMP_RETURN_PARAM_ADDR and SMP_RETURN_PARAM_LEN. Possible inbound subpackets and their respective return data contents:
- SM_RETURN_STATUS 3
- Holds a execution status report of executed subpacket. For possible return values of this, see list below. Consumes one byte from inbound payload buffer.
- SM_RETURN_VALUE_16B 2
- Return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR. Consumes 2 byte from payload buffer and can contain value up to 14 bits. Value greater than 14 bits is clipped (padded with 0s).
- SM_RETURN_VALUE_24B 1
- Return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR. Consumes 3 byte from payload buffer and can contain value up to 22 bits. Value greater than 14 bits is clipped (padded with 0s).
- SM_RETURN_VALUE_32B 0
- Return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR. Consumes 4 byte from payload buffer and can contain value up to 30 bits. Value greater than 30 bits is clipped (padded with 0s).
Possible SM_RETURN_STATUS values[edit | edit source]
- SMP_CMD_STATUS_ACK 0
- Subpacket executed with success
- SMP_CMD_STATUS_NACK 1
- Subpacket was not executed with success
- SMP_CMD_STATUS_INVALID_ADDR 2
- Subpacket was not executed because target SMP address is unkown
- SMP_CMD_STATUS_INVALID_VALUE 4
- Subpacket was not executed because value for given parameter is invalid
- SMP_CMD_STATUS_VALUE_TOO_HIGH 8
- Subpacket was not executed because value for given parameter is invalid (value was too high)
- SMP_CMD_STATUS_VALUE_TOO_LOW 16
- Subpacket was not executed because value for given parameter is invalid (value was too low)
Usage examples[edit | edit source]
- if one wants to read values of parameters, set SMP_RETURN_PARAM_LEN as 2,3 or 4 and set SMP_RETURN_PARAM_ADDR to the parameter address to be read. Lengths 2,3 and 4 will return SM_RETURN_VALUE_16B, 24B and 32B respectively.
- if one wants just status report from each executed subpacket to check correctness of communication, or to save payload amount, set SMP_RETURN_PARAM_LEN to 1 which will then return SM_RETURN_STATUS for each outbound subpacket.