Hello all, first post on this community!
Backstory: Currently building an 80W 1200x600mm (24x48") DIY Laser cutter. Running Nema 23s with external drivers in an open-drain configuration. This works nicely on stock Smoothieware. Want to try GRBL-LPC on my Smoothieboard to see what difference that makes.
Problem(s):
- I’ve possibly damaged my Alpha connection, so I switched to using the Delta connection for the X-axis. Works fine on Smoothieware, but I’ll have to reconfigure that on GRBL-LPC. I’ve swapped the pin mappings in cpu_mapping.h as follows:
#ifdef CPU_MAP_SMOOTHIEBOARD // (Smoothieboards)
// Define serial port pins and interrupt vectors.
#define SERIAL_RX USART_RX_vect
#define SERIAL_UDRE USART_UDRE_vect
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
#define STEP_DDR LPC_GPIO2->FIODIR
#define STEP_PORT LPC_GPIO2->FIOPIN
#define X_STEP_BIT 3
#define Y_STEP_BIT 1
#define Z_STEP_BIT 2
#define A_STEP_BIT 0
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)|(1<<A_STEP_BIT)) // All step bits
// Define step direction output pins. NOTE: All direction pins must be on the same port.
#define DIRECTION_DDR LPC_GPIO0->FIODIR
#define DIRECTION_PORT LPC_GPIO0->FIOPIN
#define X_DIRECTION_BIT 22
#define Y_DIRECTION_BIT 11
#define Z_DIRECTION_BIT 20
#define A_DIRECTION_BIT 5
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)|(1<<A_DIRECTION_BIT)) // All direction bits
// Define stepper driver enable/disable output pin.
#define STEPPERS_DISABLE_DDR LPC_GPIO0->FIODIR
#define STEPPERS_DISABLE_PORT LPC_GPIO0->FIOPIN
#define X_DISABLE_BIT 21
#define Y_DISABLE_BIT 10
#define Z_DISABLE_BIT 19
#define A_DISABLE_BIT 4
#define STEPPERS_DISABLE_MASK ((1<<X_DISABLE_BIT)|(1<<Y_DISABLE_BIT)|(1<<Z_DISABLE_BIT)|(1<<A_DISABLE_BIT))
...
...
I think that should be fine, but do let me know if there’s anything else I’d need to change.
- Open drain config.
To run the drivers, they’re hooked up in an open-drain configuration, but I can’t seem to figure out how to set that up in GRBL-LPC. I’ve stumbled upon this GitHub issue, but can’t quite grasp what exactly needs to be changed and where: https://github.com/gnea/grbl-LPC/issues/11
With Smoothie it’s as easy as adding a ‘o’ behind the pin. I’ll attach the relevant portion of my Smoothie config below if that helps to figure out what I’m trying to replicate with GRBL.
# Stepper module configuration
# Pins are defined as ports, and pin numbers, appending "!" to the number will invert a pin
# See http://smoothieware.org/pin-configuration and http://smoothieware.org/pinout
alpha_step_pin 2.0o! # Pin for alpha stepper step signal
alpha_dir_pin 0.5o! # Pin for alpha stepper direction, add '!' to reverse direction
alpha_en_pin 0.4o! # Pin for alpha enable pin
alpha_current 1.5 # X stepper motor current
alpha_max_rate 50000.0 # Maximum rate in mm/min
beta_step_pin 2.3o! # Pin for beta stepper step signal
beta_dir_pin 0.22o # Pin for beta stepper direction, add '!' to reverse direction
beta_en_pin 0.21o! # Pin for beta enable
beta_current 1.5 # Y stepper motor current
beta_max_rate 20000.0 # Maxmimum rate in mm/min
gamma_step_pin 2.2o! # Pin for gamma stepper step signal
gamma_dir_pin 0.20o # Pin for gamma stepper direction, add '!' to reverse direction
gamma_en_pin 0.19o! # Pin for gamma enable
gamma_current 1.5 # Z stepper motor current
gamma_max_rate 300.0 # Maximum rate in mm/min
My GRBL-LPC mask are configured as such, to account for the inverse signals (!).
#define DEFAULT_STEPPING_INVERT_MASK 7 // $2 ZYX (e.g., 0x5 inverts Z and X stepper pulses)
#define DEFAULT_DIRECTION_INVERT_MASK 1 // $3 ZYX (e.g., 0x2 inverts Y stepper direction)
#define DEFAULT_INVERT_ST_ENABLE 1 // $4 bool (inverts stepper enable pin)
Any and all guidance on this would be greatly appreciated! If someone could tell me what to add/change and where, that would be amazing!
Thanks in advance!
(Tagging some people who I’ve noticed are very much up-to-date on this: @raykholo (met at BAMF), @Todd_Fleming, @cprezzi, @Arthur_Wolf, and @Jim_Fong).