Closed hersi97 closed 1 year ago
What is the $LIM
output when:
Hi, sorry for the wait
>>> $LIM
[LIMITS:,,,]
ok
[MSG:Reset to continue]
An unexpected error was detected: (ALARM:1) Hard limit has been triggered. Machine position is likely lost due to sudden halt. Re-homing is highly recommended.
>>> $LIM
[LIMITS:Z,,,]
ok
An unexpected error was detected: (ALARM:10) Homing fail. Second dual axis limit switch failed to trigger within configured search distance after first. Try increasing trigger fail distance or check wiring.
[MSG:Emergency stop - clear, then reset to continue]
>>> $LIM
[LIMITS:,,Z,]
ok
Ok, if I understand correctly, $LIM prints out [<min>,<max>,<min2>,<max2>]
In that case, this is wrong, I have 2 Z max limit switches.
I don't see a way to config these as max limit switches in the my_machine_map.h, if I look at motor_pins.h, I only see it defining Z_LIMIT_PIN_MAX (motor_pins.h:428):
#elif Z_GANGED_LIM_MAX && !defined(M3_LIMIT_PIN_MAX)
#define Z_LIMIT_PORT_MAX M3_LIMIT_PORT
#define Z_LIMIT_PIN_MAX M3_LIMIT_PIN
#define Z_LIMIT_BIT_MAX (1<<M3_LIMIT_PIN)
#endif
I also can't find any mention of something like Z2_LIMIT_PIN_MAX macro in the source.
Homing is always towards the min limit switches. And IIRC no drivers has support for two max limit inputs on any axis as this is not (IMO) really needed in practice.
Anyway, this does not explain why only one motor is moving initially. Only an immediately triggered limit switch (after homing is started) should cause that. And since you have hard limits enabled and jogging works it is unlikely you have EMI issues.
I'll wire a F103 board up to my simulator and see if I can replicate the issue. I'll try to get it done tomorrow.
Ah okay, I'll remount them to be min limits then. Thank you
Here's my config for reference:
I commented out -D OVERRIDE_MY_MACHINE
and added this to platformio.ini
[env:BTT_SKR_MINI_E3_V20_USB_CUSTOM]
board = genericSTM32F103RC
board_build.ldscript = STM32F103RCTX_FLASH.ld
build_flags = ${common.build_flags}
-I fans
-I laser
# See Inc/my_machine.h for options
# Relocate the vector table where the boot loader expects to find them
-D VECT_TAB_OFFSET=0x7000
-Wl,--defsym=LD_VECT_TAB_OFFSET=0x7000
lib_deps = ${common.lib_deps}
eeprom
trinamic
FatFs
sdcard
USB serial support
fans
laser
lib_extra_dirs = ${common.lib_extra_dirs}
fans
laser
/*
my_machine.h - configuration for STM32F103xx ARM processors
Part of grblHAL
Copyright (c) 2020-2023 Terje Io
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/
#define BOARD_MY_MACHINE // Add my_machine_map.h before enabling this!
#define USB_SERIAL_CDC 1 // Serial communication via native USB. Comment out for UART communication.
#define SDCARD_ENABLE 1 // Run gcode programs from SD card, requires sdcard plugin.
#define FANS_ENABLE 1
#define PPI_ENABLE 1
#define Z_GANGED 1
#define Z_AUTO_SQUARE 1
#define DEFAULT_LASER_MODE 1
/*
my_machine_map.h - driver code for STM32F103RC ARM processors
Part of grblHAL
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef STM32F103xE
#error "This board has a STM32F10RCT6 processor, select a corresponding build!"
#endif
#if N_ABC_MOTORS > 1 || N_GANGED > 1
#error "Axis configuration is not supported!"
#endif
#define BOARD_NAME "BTT SKR MINI E3 V2.0"
#define BOARD_BTT_SKR_MINI_E3_V20_CUSTOM
#define MAX_STEP_RATE_HZ 800000 // Hz
#define I2C_PORT 1
#define SERIAL2_MOD
#define HAS_BOARD_INIT
#ifdef TRINAMIC_ENABLE
#undef TRINAMIC_ENABLE
#endif
#ifdef TRINAMIC_MIXED_DRIVERS
#undef TRINAMIC_MIXED_DRIVERS
#endif
#define TRINAMIC_ENABLE 2209
#define TRINAMIC_MIXED_DRIVERS 0
#if EEPROM_ENABLE < 2
#undef EEPROM_ENABLE
#define EEPROM_ENABLE 3 // 32Kbit EEPROM, 32byte page size
#endif
// Define step pulse output pins.
#define X_STEP_PORT GPIOB
#define X_STEP_PIN 13 //PB13
#define Y_STEP_PORT GPIOB
#define Y_STEP_PIN 10 //PB10
#define Z_STEP_PORT GPIOB
#define Z_STEP_PIN 0 //PB0
// Z2
#define M3_STEP_PORT GPIOB
#define M3_STEP_PIN 3 //PB3
#define STEP_OUTMODE GPIO_BITBAND
// Define step direction output pins.
#define X_DIRECTION_PORT GPIOB
#define X_DIRECTION_PIN 12 //PB12
#define Y_DIRECTION_PORT GPIOB
#define Y_DIRECTION_PIN 2 //PB2
#define Z_DIRECTION_PORT GPIOC
#define Z_DIRECTION_PIN 5 //PC5
// Z2
#define M3_DIRECTION_PORT GPIOB
#define M3_DIRECTION_PIN 4 //PB4
#define DIRECTION_OUTMODE GPIO_BITBAND
// Define stepper driver enable/disable output pin.
#define X_ENABLE_PORT GPIOB
#define X_ENABLE_PIN 14 //PB14
#define Y_ENABLE_PORT GPIOB
#define Y_ENABLE_PIN 11 //PB11
#define Z_ENABLE_PORT GPIOB
#define Z_ENABLE_PIN 1 //PB1
// Z2
#define M3_ENABLE_PORT GPIOD
#define M3_ENABLE_PIN 2 //PD2
// Define homing/hard limit switch input pins.
#define X_LIMIT_PORT GPIOC
#define X_LIMIT_PIN 0 //PC0
#define Y_LIMIT_PORT GPIOC
#define Y_LIMIT_PIN 1 //PC1
#define Z_LIMIT_PORT GPIOC
#define Z_LIMIT_PIN 2 //PC2
// Z2
#define M3_LIMIT_PORT GPIOC
#define M3_LIMIT_PIN 15 //PC15
#define LIMIT_INMODE GPIO_BITBAND
// Define spindle PWM output pin.
#define SPINDLE_PWM_PORT_BASE GPIOA_BASE
#define SPINDLE_PWM_PIN 8 //PA8
// Define user-control controls (cycle start, reset, feed hold) input pins.
#define CONTROL_PORT GPIOC
#define RESET_PIN 15 //PC15
#define FEED_HOLD_PIN 13 //PC13
#define CYCLE_START_PIN 12 //PC12
#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PIN 3 //PC3
#endif
#define CONTROL_INMODE GPIO_MAP
// Define probe switch input pin.
//#define PROBE_PORT GPIOC
//#define PROBE_PIN 14 //PC14
#if I2C_STROBE_ENABLE
#define I2C_STROBE_PORT GPIOA
#define I2C_STROBE_PIN 1 //PA1
#endif
#if SDCARD_ENABLE
#define SD_CS_PORT GPIOA
#define SD_CS_PIN 4 //PA4
// The following defines are not used but defined for reference
// Port init is done by HAL_SPI_MspInit() in stm32f1xx_hal_msp.c
#define SD_IO_PORT GPIOA
#define SD_SCK_PIN 5 //PA5
#define SD_MISO_PIN 6 //PA6
#define SD_MOSI_PIN 7 //PA7
#endif
// Define auxiliary outputs
#define AUXOUTPUT0_PORT GPIOC
#define AUXOUTPUT0_PIN 6 //PC6
#define AUXOUTPUT1_PORT GPIOC
#define AUXOUTPUT1_PIN 7 //PC7
#define AUXOUTPUT2_PORT GPIOC
#define AUXOUTPUT2_PIN 8 //PC8
#define AUXOUTPUT3_PORT GPIOC
#define AUXOUTPUT3_PIN 9 //PC9
Homing for auto squared Z works as it should in my test setup (using a SVN board). You have one major issue with your board map, the M3 limit switch input is shared with Reset (E-Stop) on PC15 - not good. But again this does not explain why only one motor moves initially.
In order to debug this can you add calls to report_current_limit_state(0, NULL)
at line 386 and before line 400 in machine_limits.c? This will output limit pin states before homing starts and when an auto-squared motor is disabled. Is the call at line 400 executed immediately after homing starts?
You have one major issue with your board map, the M3 limit switch input is shared with Reset (E-Stop) on PC15 - not good. But again this does not explain why only one motor moves initially.
Oops, yeah, I did not realize that, I changed it to PC3, it's free, I don't have the safety door enabled.
And yes, this was indeed the solution to the homing problem.
Here's the output from the console:
>>> $HZ
[LIMITS:,,,]
[LIMITS:Z,,,]
[LIMITS:,,Z,]
[LIMITS:,,,]
[LIMITS:,,Z,]
[LIMITS:Z,,Z,]
[MSG:]
ok
Edit: Some things I haven't shared, I also set $14=71 (set the EStop bit) after I changed the map.
Without modifications to the map and settings, this is what the output is:
>>> $HZ
[LIMITS:,,,]
[LIMITS:Z,,,]
An error was detected while sending '$HZ': (ALARM:6) Homing fail. The active homing cycle was reset. Streaming has been paused.
An unexpected error was detected: (ALARM:10) Homing fail. Second dual axis limit switch failed to trigger within configured search distance after first. Try increasing trigger fail distance or check wiring.
[MSG:Emergency stop - clear, then reset to continue]
Error while processing response <ok>: An unexpected command was completed by the controller.
I am willing to do some more testing on my machine, if you want
I am willing to do some more testing on my machine, if you want
Yes, please report any issues you might encounter. Is the board map for a board you have made? Is it available, either to buy or as a public design?
I used the machine for a couple days now, it's running fine, without much fuss. I didn't have to move the positive Z limits either. I just had to get used to how multiple coordinate systems work (G53-G59 and G28) and how CNC machines home to a "negative" space.
The machine is basically a heavily modded Ender 3 Pro that I had spare, since I bought an other 3d printer. This Ender 3 has two independent Z axes, a diode laser head, linear rods and bearings, solid aluminium bed stud spacers (spring delete) and a silent stepper board (BigTreeTech SKR E3 Mini v2.0). I thought I would repurpose it to do some laser engraving. E.g. on photoresist with simple single or double sided PCBs that I wouldn't want to order from something like AISLER and such.
Hello!
Currently I'm trying to use grblHAL with a small dual Z axis machine. The board I'm using is BigTreeTech SKR mini e3. (TMC2209 drivers)
The issue I'm facing is whenever I try to home the Z axis only one motor moves, and racks the gantry before I have to EStop it. If I manually rotate the Z axes close to the limit switches, and home the Z, I get:
Weirdly, if I jog the machine both Z axis motors move without problems.
I'm using grblHAL/STM32F1xx repo as a base. (only I added fans and laser modules)
I have the following enabled in my_machine.h:
I'm using the E0 output as the Z2 pins.
My settings are the following: