diff --git a/GRBL_Advanced_F446RE.ebp b/GRBL_Advanced_F446RE.ebp
index b1cef6b..46c54ed 100644
--- a/GRBL_Advanced_F446RE.ebp
+++ b/GRBL_Advanced_F446RE.ebp
@@ -217,10 +217,10 @@
-
+
-
+
diff --git a/HAL/STM32/stm32f4xx_it.c b/HAL/STM32/stm32f4xx_it.c
index 64a8256..e03f19c 100644
--- a/HAL/STM32/stm32f4xx_it.c
+++ b/HAL/STM32/stm32f4xx_it.c
@@ -28,7 +28,7 @@
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_it.h"
-#include "USART.h"
+#include "Usart.h"
#include "FIFO_USART.h"
#include "Limits.h"
#include "Stepper.h"
diff --git a/HAL/USART/FIFO_USART.h b/HAL/USART/FIFO_USART.h
index 0dc9022..64245ad 100644
--- a/HAL/USART/FIFO_USART.h
+++ b/HAL/USART/FIFO_USART.h
@@ -20,7 +20,7 @@
#include
#include
-#include "USART.h"
+#include "Usart.h"
/* Queue structure */
diff --git a/HAL/USART/USART.c b/HAL/USART/USART.c
index b368fe5..be2997c 100644
--- a/HAL/USART/USART.c
+++ b/HAL/USART/USART.c
@@ -16,7 +16,7 @@
along with STM32F4_HAL. If not, see .
*/
#include
-#include "USART.h"
+#include "Usart.h"
#include "FIFO_USART.h"
diff --git a/Libraries/GrIP/ComIf.c b/Libraries/GrIP/ComIf.c
index c387b38..3523949 100644
--- a/Libraries/GrIP/ComIf.c
+++ b/Libraries/GrIP/ComIf.c
@@ -19,7 +19,7 @@
#include "ServerTCP.h"
#include "Platform.h"
#include "Print.h"
-#include "USART.h"
+#include "Usart.h"
#include
diff --git a/Makefile b/Makefile
index aabb5e3..a8d266c 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ INCLUDES := $(SOURCES) SPL/inc
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
-FLAGS := -mfloat-abi=hard -mcpu=cortex-m4 -gdwarf-2 -mfpu=fpv4-sp-d16 -mthumb
+FLAGS := -mfloat-abi=hard -mcpu=cortex-m4 -gdwarf-2 -mfpu=fpv4-sp-d16 -mthumb -Wno-misleading-indentation
CFLAGS := -O2 -g1 -std=c11 -Wall -Wextra $(INCLUDE) -fno-common -fsingle-precision-constant -fdata-sections -ffunction-sections -fomit-frame-pointer -mlittle-endian -DUSE_STDPERIPH_DRIVER -DSTM32F411xE -DSTM32F411RE -D__FPU_USED -DARM_MATH_CM4 -Wimplicit-fallthrough=0
CXXFLAGS := $(CFLAGS)
@@ -97,11 +97,11 @@ export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
export OUTPUT := $(CURDIR)/$(TARGET)
-.PHONY: $(BUILD) clean flash
+.PHONY: all clean flash
#---------------------------------------------------------------------------------
-$(BUILD):
- @[ -d $@ ] || mkdir -p $@
+all:
+ @[ -d $(BUILD) ] || mkdir -p $(BUILD)
@make --no-print-directory -C $(BUILD) $(OUTPUT).elf $(OUTPUT).bin $(OUTPUT).hex $(OUTPUT).lst -f $(CURDIR)/Makefile -j2
@$(SIZE) $(OUTPUT).elf
diff --git a/README.md b/README.md
index a4c709a..74ba599 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-![GitHub Logo](https://github.com/Schildkroet/GRBL-Advanced/blob/software/en.nucleo-F4.jpg?raw=true)
+![GitHub Logo](https://github.com/Schildkroet/GRBL-Advanced/blob/software/doc/en.nucleo-F4.jpg?raw=true)
***
Grbl-Advanced is a no-compromise, high performance, low cost alternative for CNC milling. This version of Grbl-Advanced runs on a STM32F411 Nucleo Board.
@@ -38,12 +38,12 @@ Uses Dynamic TLO when $14=2
#### I2C EEPROM
Added support for external EEPROM (e.g. ST M24C08). Uncomment 'USE_EXT_EEPROM' in Config.h.
-![EEPROM](https://github.com/Schildkroet/GRBL-Advanced/blob/software/eeprom.png?raw=true)
+![EEPROM](https://github.com/Schildkroet/GRBL-Advanced/blob/software/doc/eeprom.png?raw=true)
#### ETHERNET Support
GRBL-Advanced can be controlled with USB or ETHERNET. For ETHERNET an additional W5500 Module is required. Then uncomment ETH_IF in Platform.h. The default IP Address is 192.168.1.20.
Use [Candle 2](https://github.com/Schildkroet/Candle2) as control interface.
-![W5500](https://github.com/Schildkroet/GRBL-Advanced/blob/software/w5500.png?raw=true)
+![W5500](https://github.com/Schildkroet/GRBL-Advanced/blob/software/doc/w5500.png?raw=true)
#### Attention
By default, settings are stored in internal flash memory in last sector. First startup takes about 5-10sec to write all settings.
@@ -62,7 +62,7 @@ By default, settings are stored in internal flash memory in last sector. First s
* 96 MHz CPU frequency
* 512 KB Flash
* 128 KB SRAM
----
+
* [STM32 Nucleo F446RE](https://www.st.com/en/evaluation-tools/nucleo-f446re.html)
* STM32F446RE in LQFP64 package
* ARM®32-bit Cortex®-M4 CPU with FPU
@@ -81,8 +81,16 @@ By default, settings are stored in internal flash memory in last sector. First s
* Flash HEX created in bin/Release
#### Linux
-* Install Build Essentials, [GNU ARM Embedded Toolchain](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm) and [texane st-util](https://github.com/texane/stlink)
-* Run 'make' and 'make flash' in Terminal
+* Download [GNU ARM Embedded Toolchain](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm)) and unpack it to /opt. In makefile update path to toolchain.
+* Run following commands:
+```
+sudo apt install build-essential stlink-tools
+```
+* Clone repository and run following commands:
+```
+make clean
+make all flash
+```
***
diff --git a/Src/Print.c b/Src/Print.c
index 6d3a942..96f9505 100644
--- a/Src/Print.c
+++ b/Src/Print.c
@@ -4,7 +4,7 @@
#include
#include "Print.h"
#include "Config.h"
-#include "USART.h"
+#include "Usart.h"
#include "FIFO_USART.h"
#include "Settings.h"
#include "GrIP.h"
diff --git a/eeprom.png b/doc/eeprom.png
similarity index 100%
rename from eeprom.png
rename to doc/eeprom.png
diff --git a/en.nucleo-F4.jpg b/doc/en.nucleo-F4.jpg
similarity index 100%
rename from en.nucleo-F4.jpg
rename to doc/en.nucleo-F4.jpg
diff --git a/pinout_left.png b/doc/pinout_left.png
similarity index 100%
rename from pinout_left.png
rename to doc/pinout_left.png
diff --git a/pinout_right.png b/doc/pinout_right.png
similarity index 100%
rename from pinout_right.png
rename to doc/pinout_right.png
diff --git a/w5500.png b/doc/w5500.png
similarity index 100%
rename from w5500.png
rename to doc/w5500.png
diff --git a/grbl/Config.h b/grbl/Config.h
index 1a91964..12216d4 100644
--- a/grbl/Config.h
+++ b/grbl/Config.h
@@ -399,7 +399,7 @@
// correction with expensive sin() and cos() calcualtions. This parameter maybe decreased if there
// are issues with the accuracy of the arc generations, or increased if arc execution is getting
// bogged down by too many trig calculations.
-#define N_ARC_CORRECTION 6 // Integer (1-255)
+#define N_ARC_CORRECTION 4 // Integer (1-255)
// The arc G2/3 g-code standard is problematic by definition. Radius-based arcs have horrible numerical
diff --git a/grbl/GCode.c b/grbl/GCode.c
index 650c239..8e2a0eb 100644
--- a/grbl/GCode.c
+++ b/grbl/GCode.c
@@ -1798,6 +1798,9 @@ uint8_t GC_ExecuteLine(char *line)
Spindle_SetState(SPINDLE_DISABLE, 0.0);
Coolant_SetState(COOLANT_DISABLE);
}
+ // Reset tool change - May not be in accordance with LinuxCNC
+ TC_Init();
+
Report_FeedbackMessage(MESSAGE_PROGRAM_END);
}
diff --git a/grbl/MotionControl.c b/grbl/MotionControl.c
index 8152be5..e9d5454 100644
--- a/grbl/MotionControl.c
+++ b/grbl/MotionControl.c
@@ -48,7 +48,7 @@ void MC_Init(void)
{
for(uint8_t i = 0; i < N_AXIS; i++)
{
- dir_negative[i] = DIR_NEGATIV ^ (settings.homing_dir_mask & (1<> i) & 0x1;
}
MC_SyncBacklashPosition();
@@ -351,6 +351,8 @@ void MC_Dwell(float seconds)
// executing the homing cycle. This prevents incorrect buffered plans after homing.
void MC_HomigCycle(uint8_t cycle_mask)
{
+ Stepper_WakeUp();
+
// Check and abort homing cycle, if hard limits are already enabled. Helps prevent problems
// with machines with limits wired on both ends of travel to one limit pin.
// TODO: Move the pin-specific LIMIT_PIN call to limits.c as a function.
diff --git a/grbl/SpindleControl.c b/grbl/SpindleControl.c
index ff3ef37..ecb0bed 100644
--- a/grbl/SpindleControl.c
+++ b/grbl/SpindleControl.c
@@ -173,6 +173,12 @@ void Spindle_SetState(uint8_t state, float rpm)
GPIO_SetBits(GPIO_SPINDLE_DIR_PORT, GPIO_SPINDLE_DIR_PIN);
}
+ #ifdef INVERT_SPINDLE_ENABLE_PIN
+ GPIO_ResetBits(GPIO_SPINDLE_ENA_PORT, GPIO_SPINDLE_ENA_PIN);
+ #else
+ GPIO_SetBits(GPIO_SPINDLE_ENA_PORT, GPIO_SPINDLE_ENA_PIN);
+ #endif
+
// NOTE: Assumes all calls to this function is when Grbl is not moving or must remain off.
if(settings.flags & BITFLAG_LASER_MODE) {
if(state == SPINDLE_ENABLE_CCW) {
diff --git a/grbl/Stepper.c b/grbl/Stepper.c
index 1154568..bea5517 100644
--- a/grbl/Stepper.c
+++ b/grbl/Stepper.c
@@ -69,7 +69,7 @@
#ifdef MAX_STEP_RATE_HZ
#define STEP_TIMER_MIN (uint16_t)(F_TIMER_STEPPER / MAX_STEP_RATE_HZ)
#else
- #define STEP_TIMER_MIN (uint16_t)((F_TIMER_STEPPER / 60000))
+ #define STEP_TIMER_MIN (uint16_t)((F_TIMER_STEPPER / 90000))
#endif
@@ -395,7 +395,7 @@ void Stepper_MainISR(void)
st.exec_segment = &segment_buffer[segment_buffer_tail];
// Initialize step segment timing per step and load number of steps to execute.
- // Limit ISR to 50 KHz
+ // Limit ISR frequency
if(st.exec_segment->cycles_per_tick < STEP_TIMER_MIN) {
st.exec_segment->cycles_per_tick = STEP_TIMER_MIN;
}
diff --git a/grbl/System.c b/grbl/System.c
index c890b14..d534273 100644
--- a/grbl/System.c
+++ b/grbl/System.c
@@ -490,7 +490,7 @@ void System_FlagWcoChange(void)
// serves as a central place to compute the transformation.
float System_ConvertAxisSteps2Mpos(const int32_t *steps, const uint8_t idx)
{
- float pos;
+ float pos = 0.0;
#ifdef COREXY
if(idx == X_AXIS) {
@@ -503,7 +503,11 @@ float System_ConvertAxisSteps2Mpos(const int32_t *steps, const uint8_t idx)
pos = steps[idx]/settings.steps_per_mm[idx];
}
#else
- pos = steps[idx]/settings.steps_per_mm[idx];
+ if(settings.steps_per_mm[idx] != 0)
+ {
+ pos = steps[idx] / settings.steps_per_mm[idx];
+ }
+
#endif
return pos;
diff --git a/grbl/ToolChange.c b/grbl/ToolChange.c
index d7204e0..c2e70d7 100644
--- a/grbl/ToolChange.c
+++ b/grbl/ToolChange.c
@@ -29,6 +29,9 @@
#include "defaults.h"
+#define TOOL_SENSOR_OFFSET 70.0 // mm
+
+
static uint8_t isFirstTC = 1;
static int32_t toolOffset = 0;
static int32_t toolReferenz = 0;
@@ -119,7 +122,7 @@ void TC_ProbeTLS(void)
MC_Line(position, &pl_data);
// Move down with offset (for tool)
- position[Z_AXIS] = (settings.tls_position[Z_AXIS] / settings.steps_per_mm[Z_AXIS]) + 90.0;
+ position[Z_AXIS] = (settings.tls_position[Z_AXIS] / settings.steps_per_mm[Z_AXIS]) + TOOL_SENSOR_OFFSET;
MC_Line(position, &pl_data);
// Wait until queue is processed
diff --git a/grbl/defaults.h b/grbl/defaults.h
index d3ecd64..0d1e1f4 100644
--- a/grbl/defaults.h
+++ b/grbl/defaults.h
@@ -78,7 +78,6 @@
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
#define DEFAULT_TOOL_CHANGE_MODE 0 // 0 = Ignore M6; 1 = Manual tool change; 2 = Manual tool change + TLS
- #define DEFAULT_TOOL_SENSOR_OFFSET 100.0 // mm
#endif