Open marcoaccame opened 3 years ago
xwcwe mc4plus.hex.zip
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| CLS | SRC | DST / TYP |
CAN ID
0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| unused | CLS | SRC | DST / TYP |
CAN ID (11 bits right aligned)
B1 B0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| unused | CLS | SRC | DST / TYP |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
CAN ID (11 bits right aligned)
B0 B1
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| unused | CLS | DST | DST / TYP |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
MOTOR_POLLING
B0 B1
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| M | CMD | INFO0 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
B2 B3
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| INFO1 | INFO2 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
B4 B5
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| INFO3 | INFO4 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
B6 B7
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| INFO5 | INFO6 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
CAN ID11
+---+---+---+---+---+---+---+---+---+---+---+
|3b CLS |4b DST |4b DST / TYP |
+---+---+---+---+---+---+---+---+---+---+---+
w/ unicode
design
├───control
├───messaging
├───supervisor
└───__system
├ ௰
_
⎢
¯____
⑧⑳⑻ ⒃
⎵xsx
⎣
└
⎿┬╍╰
⏐
⎣
_
+----+----+
├ A |
+----+----+
The CAN protocol used for Motion Control uses two classes of the iCub CAN protocol: the Motor Control Command
class and the Motor Control Streaming
class.
In here we describe the format of the messages used by the foc
board which shall also be used for the used for the amcbldc
board.
We start with explaining the generic structure of the iCub CAN frame and then we focus on the used messages.
[TOC]
The structure of the generic iCub CAN frame is the following.
CAN FRAME:
+--------+ +-------------------------------------------+
| ID | | PAYLOAD |
+--------+ +-------------------------------------------+
11 bits L = [1, 8] bytes
Figure. The CAN frame is formed by an ID
which is 11 bits plus a PAYLOAD
which can be L bytes long, where L
varies from 1 to 8.
ID
The ID
contains three fields used to extract the information transported by the PAYLOAD
.
Here are details of the ID
.
ID:
+---+---+---+---+---+---+---+---+---+---+---+
| CLS | SRC | DST / TYP |
+---+---+---+---+---+---+---+---+---+---+---+
3 bits 4 bits 4 bits
Figure. The ID
contains three fields: the CLS tells about which type of messages, the SRC
is the address of the sender, the third field can one of two depending on values of CLS
: either the destination address DST
or the a further sub-type TYP
of the message inside the payload.
Value of CLS |
Description | Third field of ID |
---|---|---|
0b000 | Motor Control Command | DST |
0b001 | Motor Control Streaming | TYP |
0b010 | Analog Sensors Command | DST |
0b100 | Skin Sensor Streaming | TYP |
0b101 | Inertial Sensor Streaming | TYP |
0b110 | For Future Use | TYP |
0b111 | Management / Bootloader | DST |
Table. The possible values for CLS
.
The values of ID.TYP depend on the class CLS. We shall show these values later.
PAYLOAD
The PAYLOAD can have two formats depending if the class CLS
has a DST
or a TYP
.
PAYLOAD:
+---+---+---+---+---+---+---+---+---+---+---+ - - - - +---+
| CMD | ARG |
+---+---+---+---+---+---+---+---+---+---+---+ - - - - +---+
1 byte 0 / 7 bytes
Figure. Format of thePAYLOAD
for the case of ID w/ a DST
field. This is the case of a command message which has a command field CMD
plus possible arguments inside ARG
. There is a different CMD
for each class CLS
.
PAYLOAD:
+---+---+---+---+---+---+---+---+---+---+---+ - - - - +---+
| DATA |
+---+---+---+---+---+---+---+---+---+---+---+ - - - - +---+
1 / 8 bytes
Figure. Format of thePAYLOAD
for the case of ID w/ a TYP
field. This is the case of a streaming message which uses the full PAYLOAD
to carry DATA
of the type and formatting specified by the pair {ID.CLS
, ID.TYP
}.
amcbldc
boardThey are a subset of the complete set of messages. Here they are.
MCC
In this class the PAYLOAD.CMD
field reserves one bit to specify if the command is about motor 0 or motor 1. The other 7 bits specify up to 128 possible commands specified by an operational code.
PAYLOAD.CMD for Motor Control Command Class:
1 bit
|
+---+---+---+---+---+---+---+---+
| M | OPC |
+---+---+---+---+---+---+---+---+
|
7 bits
Figure. The PAYLOAD.CMD
byte contains CMD.M
which specifies to which motor to apply the operational code CMD.OPC
.
The bytes inside PAYLOAD.ARG
depend on the values of each operational code.
MCC::SET_CONTROL_MODE
.The length of the PAYLOAD.ARG
= 1 (L
= 2).
PAYLOAD.ARG for MCC::SET_CONTROL_MODE:
+---+---+---+---+---+---+---+---+
| MODE |
+---+---+---+---+---+---+---+---+
1 byte
Figure. The PAYLOAD.ARG
of MCC::SET_CONTROL_MODE
contains only 1 byte with the desired control mode.
Value of MODE |
Tag | Description |
---|---|---|
0x00 | Idle | |
0x50 | OpenLoop | |
0x0A | SpeedVoltage | |
0x06 | Current |
Table. The possible values for MODE
.
this is just renamed. remove
.renamed.zip
and use it for the mc4plus mc4plus.hex.renamed.zip