Setting Up Axis Motors - bdring/6-Pack_CNC_Controller GitHub Wiki
Overview
There are 6 motor driver sockets. You can use up to 6 axes and up to 2 motors per axes with a total of 6 motors. These are referenced by the axis letters X, Y, Z, A, B, and C and X2, Y2, Z2, A2, B2 and C2. X2 would be the second motor on X. Any of those letters can be assigned to any motor socket.
You chose the number of axes you want with a #define N_AXIS 3 definition. The default is 3 if you do not specify. You can only specify 3 - 6. You must use axes in XYZABC order, so #define N_AXIS 4 always means XYZA.
If you only need X, Y and A axes, you would use #define N_AXIS 4 but only assign I/O pins to X,Y and A. Any axes in the N_AXIS count that are not defined will use a virtual axis. It will appear to exist and can be commanded to move, but it does not use any I/O. It is just a virtual axis inside Grbl_ESP32.
Note The schematic refers to specific letters on the 6 sockets. That is not required.
Assigning I/O Pins to Motors
You assign I/O pins to motors in your machine definition file. The I/O pin numbers are hardwired to motor sockets as shown below. The CS/MS3 pins are use for Chip Select on Trinamic SPI drivers and Micro-stepping config pin #3 on step stick drivers. Currently the MS3 pin is set to high in StepStick mode.
// Motor Socket #1 (Left End)
Disable I2SO(0)
Direction I2SO(1)
Step I2SO(2)
CS/MS3 I2SO(3)
// Motor Socket #2
Direction I2SO(4)
Step I2SO(5)
CS/MS3 I2SO(6)
Disable I2SO(7)
// Motor Socket #3
Disable I2SO(8)
Direction I2SO(9)
Step I2SO(10)
CS/MS3 I2SO(11)
// Motor Socket #4
Direction I2SO(12)
Step I2SO(13)
CS/MS3 I2SO(14)
Disable I2SO(15)
// Motor Socket #5
Disable I2SO(16)
Direction I2SO(17)
Step I2SO(18)
CS/MS3 I2SO(19)
// Motor Socket #6
Direction I2SO(20)
Step I2SO(21)
CS/MS3 I2SO(22)
Disable I2SO(23)
You would assign these pins as follows.
Stepstick Drivers.
These are the basic step and direction drivers. They are also known as Pololu drivers. You need to assign all pins. Below is an example showing X in socket 1 and X2 in socket 2.
FluidNC Firmware Config Example
motor0:
limit_neg_pin: gpio.33
limit_pos_pin: gpio.32
limit_all_pin: NO_PIN
hard_limits: false
pulloff_mm:1.000
stepstick:
ms3_pin: i2so.3
step_pin: I2SO.2
direction_pin: I2SO.1
disable_pin: I2SO.0
Grbl_ESP32 Firmware Example
#define USE_STEPSTICK // Required to Use the MS3 pins
// Motor Socket #1
#define X_DISABLE_PIN I2SO(0)
#define X_DIRECTION_PIN I2SO(1)
#define X_STEP_PIN I2SO(2)
#define X_STEPPER_MS3 I2SO(3)
// Motor Socket #2
#define X2_DIRECTION_PIN I2SO(4)
#define X2_STEP_PIN I2SO(5)
#define X2_STEPPER_MS3 I2SO(6)
#define X2_DISABLE_PIN I2SO(7)
Trinamic Drivers
Trinamic drivers run in SPI mode. They require the CS (Chip Select) pin and a few other values. The RSENSE is the sense resistor value on the module. Typically it will be the default. You must define all the drivers that you have installed. An undefined driver will not have a controlled CS and interfere with other drivers.
FluidNC Firmware Config Example
motor0:
limit_neg_pin: gpio.33
limit_pos_pin: NO_PIN
limit_all_pin: NO_PIN
hard_limits: false
pulloff_mm:1.000
tmc_2130:
cs_pin: i2so.3
run_amps: 0.50
hold_amps: 0.20
microsteps: 16
stallguard: 0
stallguard_debug: false
toff_disable: 0
toff_stealthchop: 5
toff_coolstep: 3
run_mode: CoolStep
homing_mode: CoolStep
use_enable: false
step_pin: I2SO.2
direction_pin: I2SO.1
disable_pin: I2SO.0
Grbl_ESP32 Firmware Example
#define TRINAMIC_RUN_MODE Motors::TrinamicMode::StealthChop // can be StealthChop (default) or CoolStep
#define TRINAMIC_HOMING_MODE Motors::TrinamicMode::StallGuard // can be StealthChop, CoolStep or StallGuard.
// Motor Socket #1
#define X_TRINAMIC_DRIVER 2130 // the model number of the drive being used
#define X_DISABLE_PIN I2SO(0)
#define X_DIRECTION_PIN I2SO(1)
#define X_STEP_PIN I2SO(2)
#define X_CS_PIN I2SO(3)
#define X_RSENSE TMC2130_RSENSE_DEFAULT // or actual ohm value like 0.11
// Motor Socket #2
#define X2_TRINAMIC_DRIVER 2130
#define X2_DIRECTION_PIN I2SO(4)
#define X2_STEP_PIN I2SO(5)
#define X2_DISABLE_PIN I2SO(7)
#define X2_CS_PIN I2SO(6)
#define X2_RSENSE TMC2130_RSENSE_DEFAULT
External Drivers
External drivers only use the disable, step and direction pins.
Trinamic Drivers
motor0:
limit_neg_pin: gpio.33
limit_pos_pin: NO_PIN
limit_all_pin: NO_PIN
hard_limits: false
pulloff_mm: 1.000
standard_stepper:
step_pin: I2SO.2
direction_pin: I2SO.1
disable_pin: I2SO.0
Grbl_ESP32 Firmware Example
// Motor Socket #1
#define X_DISABLE_PIN I2SO(0)
#define X_DIRECTION_PIN I2SO(1)
#define X_STEP_PIN I2SO(2)
// Motor Socket #2
#define X2_DIRECTION_PIN I2SO(4)
#define X2_STEP_PIN I2SO(5)
#define X2_DISABLE_PIN I2SO(7)
Jumpers
It is important that you set the jumpers correctly. See this page.
Motor Ganging
When you have two motors per axis there are ganged and will move together in most modes. If you change the direction via $StepperDirInvert, they will both change direction. If you only want one to change direction you must do that in the wiring. Swap the wires on either one of the motors poles.
Auto Squaring
This is a feature where the 2 motors can self square using a homing switch on each motor. This is enable with the $Homing/Squared setting. Send $Homing/Squared=X Y to square the X and Y axes.
Mixing Driver Types
The CS/MS3 pin is used for StepStick and Trinamic drivers in deferent ways. Therefore you cannot mix those types. The external drivers to not use that pin, so you can mix external drivers and StepSticks or external drivers and Trinamic drivers.
The Trinamic drivers use the same SPI signals as the SD card, so you must set the Vcc jumper to 3.3V if you use Trinamic drivers and an SD card. This may impact your ability to use external drivers.
RC and Dynamixel Servos
These are a special types of axis motors that do not use the motor sockets. They use CNC i/O module sockets. This could allow you to have more than 6 axis motors.