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

updates to stepper 2.0 proposal based on comments #79

Merged
merged 3 commits into from
Jan 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 96 additions & 39 deletions stepper-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Protocol
6 num steps-per-revolution LSB
7 num steps-per-revolution MSB
8 maxSpeed LSB
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably get away with maxSpeed as a 14-bit number if we don't require a multiplier for it like we do when setting the speed value. In this case maxSpeed would probably rarely exceed 1000.

9 maxSpeed MSB
9 maxSpeed MSB
10 motorPin1 or directionPin number (0-127)
11 motorPin2 or stepPin number (0-127)
12 [when interface >= 0x0110000] motorPin3 (0-127)
Expand All @@ -59,42 +59,69 @@ Protocol
```
0 START_SYSEX (0xF0)
1 Stepper Command (0x62)
2 stop command (0x01)
2 zero command (0x01)
3 device number (0-9)
4 END_SYSEX (0xF7)
```

**Stepper step**
**Stepper step (relative move)**

Position is specified as a 32-bit signed long.

The speed value is a float composed of a 23-bit significand (mantissa) and a 4-bit exponent
(biased -18 with an explicit 1's bit) and a sign bit.

|27 |26-23 |22-0 |
|-----|--------|-----------|
|sign |exponent|significant|
|1 bit|4 bits |23 bits |


```
0 START_SYSEX (0xF0)
1 Stepper Command (0x62)
2 step command (0x02)
3 device number (0-9)
4 direction (0-1) (0x00 = CW, 0x01 = CCW)
5 num steps byte1 LSB
6 num steps byte2
7 num steps byte3 MSB (21 bits (2,097,151 steps max))
8 num speed LSB (steps per second)
9 num speed MSB
10 END_SYSEX (0xF7)
4 num steps, bits 0-6
5 num steps, bits 7-13
6 num steps, bits 14-20
7 num steps, bits 21-27
8 num steps, bits 28-32
9 speed, bits 0-6 (steps per second)
10 speed, bits 7-13
11 speed, bits 14-20
12 speed, bits 21-28
13 END_SYSEX (0xF7)
```

**Stepper to**
**Stepper to (absolute move)**

Sets a stepper to a desired position based on the number of steps from the zero position.
Position is specified as a 32-bit signed long.

The speed value is float composed of a 23-bit significand (mantissa) and a 4-bit exponent
(biased -18 with an explicit 1's bit) and a sign bit.

|27 |26-23 |22-0 |
|-----|--------|-----------|
|sign |exponent|significant|
|1 bit|4 bits |23 bits |

```
0 START_SYSEX (0xF0)
1 Stepper Command (0x62)
2 to command (0x03)
3 device number (0-9)
4 num target byte1 LSB
5 num target byte2 MSB
6 speed LSB (steps per second)
7 speed MSB
8 [optional] accel LSB (acceleration in steps/sec^2)
9 [optional] accel MSB
10 [optional] decel LSB (deceleration in steps/sec^2)
11 [optional] decel MSB
12 END_SYSEX (0xF7)
4 num steps, bits 0-6
5 num steps, bits 7-13
6 num steps, bits 14-20
7 num steps, bits 21-27
8 num steps, bits 28-32
9 speed, bits 0-6 (steps per second)
10 speed, bits 7-13
11 speed, bits 14-20
12 speed, bits 21-27
13 END_SYSEX (0xF7)
```

**Stepper enable**
Expand All @@ -103,8 +130,8 @@ Sets a stepper to a desired position based on the number of steps from the zero
1 Stepper Command (0x62)
2 enable command (0x04)
3 device number (0-9)
4 device state (HIGH | LOW)
4 END_SYSEX (0xF7)
4 device state (HIGH : enabled | LOW : disabled)
5 END_SYSEX (0xF7)
```

**Stepper stop**
Expand All @@ -116,19 +143,27 @@ Sets a stepper to a desired position based on the number of steps from the zero
4 END_SYSEX (0xF7)
```

**Stepper report position (sent when a move completes or stop is called)**
**Stepper report position**

Sent when a move completes or stop is called. Position is reported as a 32-bit signed long.

```
0 START_SYSEX (0xF0)
1 Stepper Command (0x62)
2 stop reply command (0x06)
3 device number (0-9)
4 position byte 1 LSB
5 position byte 2 MSB
6 END_SYSEX (0xF7)
4 position, bits 0-6
5 position, bits 7-13
6 position, bits 14-20
7 position, bits 21-27
8 position, bits 28-32
9 END_SYSEX (0xF7)
```

**Stepper limit**

When a limit pin (digital) is set to its limit state, movement in that direction is disabled.

```
0 START_SYSEX (0xF0)
1 Stepper Command (0x62)
Expand All @@ -142,19 +177,32 @@ When a limit pin (digital) is set to its limit state, movement in that direction
```

**Stepper set acceleration**
Sets the acceleration/deceleration in steps/sec^2.

Sets the acceleration/deceleration in steps/sec^2. The accel value is composed of a 23-bit
significand (mantissa) and a 4-bit exponent (biased -18 with an explicit 1's bit) and a sign bit.

|27 |26-23 |22-0 |
|-----|--------|-----------|
|sign |exponent|significant|
|1 bit|4 bits |23 bits |


```
0 START_SYSEX (0xF0)
1 Stepper Command (0x62)
2 set acceleration command (0x08)
3 device number (0-9) (Supports up to 10 motors)
4 accel LSB (acceleration in steps/sec^2)
5 accel MSB
6 END_SYSEX (0xF7)
4 accel, bits 0-6 (acceleration in steps/sec^2)
5 accel, bits 7-13
6 accel, bits 14-20
7 accel, bits 21-28
8 END_SYSEX (0xF7)
```

**MultiStepper configuration**

Stepper instances that have been created with the stepper configuration command above can be added to a multiStepper group. Groups can be sent a list of devices/positions in a single command and their movements will be coordinated to begin and end simultaneously. Note that multiStepper does not support acceleration or deceleration.

```
0 START_SYSEX (0xF0)
1 Stepper Command (0x62)
Expand All @@ -181,12 +229,15 @@ Stepper instances that have been created with the stepper configuration command
2 multi to command (0x21)
3 group number (0-127)
4 member number (0-9)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like member number could be dropped here. MultiStepper To command would expect to receive as many blocks of "num steps" as there are members in the group, and the index of each block implicitly specifies the group member.

As @dtex suggested, in cases where only a subset of the steppers needs to be controlled, a new group can be created with only the subset as members.

5 num member target byte1 LSB
6 num member target byte2 MSB
5 num steps, bits 0-6
6 num steps, bits 7-13
7 num steps, bits 14-20
8 num steps, bits 21-27
9 num steps, bits 28-32

*Optionally repeat 4 through 6 for each device in group*
*Optionally repeat 4 through 9 for each device in group*

33 END_SYSEX (0xF7)
63 END_SYSEX (0xF7)
```

**MultiStepper stop**
Expand All @@ -198,17 +249,23 @@ Stepper instances that have been created with the stepper configuration command
4 END_SYSEX (0xF7)
```

**MultiStepper report positions (sent when a move completes or stop is called)**
**MultiStepper report positions**

Sent when a move completes or stop is called.

```
0 START_SYSEX (0xF0)
1 Stepper Command (0x62)
2 multi stop reply command (0x24)
3 group number (0-127)
4 member number (0-9)
5 device 0 position byte 1 LSB
6 device 0 position byte 2 MSB
5 position, bits 0-6
6 position, bits 7-13
7 position, bits 14-20
8 position, bits 21-27
9 position, bits 28-32

*Optionally repeat 4 through 6 for each device in group*
*Optionally repeat 4 through 9 for each device in group*

33 END_SYSEX (0xF7)
63 END_SYSEX (0xF7)
```