kopia lustrzana https://github.com/Schildkroet/GRBL-Advanced
Small improvements; Updated docs
Signed-off-by: Patrick Felixberger <robomaniac8@googlemail.com>software
rodzic
c6916ceb0b
commit
48b6766dde
|
@ -1,5 +1,11 @@
|
||||||
bin/*
|
bin/*
|
||||||
obj/*
|
obj/*
|
||||||
|
build/*
|
||||||
*.depend
|
*.depend
|
||||||
*.layout
|
*.layout
|
||||||
grbl-master
|
grbl-master
|
||||||
|
*.hex
|
||||||
|
*.bin
|
||||||
|
*.elf
|
||||||
|
*.lst
|
||||||
|
*.map
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* D12: Z_LIMIT_BIT: PA6
|
* D12: Z_LIMIT_BIT: PA6
|
||||||
* D13: SPINDLE_DIRECTION_BIT: PA5
|
* D13: SPINDLE_DIRECTION_BIT: PA5
|
||||||
* D14: SPINDLE_ENABLE_BIT: PB7
|
* D14: SPINDLE_ENABLE_BIT: PB7
|
||||||
* D15: SAFETY_DOOR_ENABLE_BIT: PB8
|
* D15: SAFETY_DOOR_ENABLE_BIT: PC2
|
||||||
*
|
*
|
||||||
* A0: CONTROL_RESET_BIT: PA0
|
* A0: CONTROL_RESET_BIT: PA0
|
||||||
* A1: CONTROL_FEED_HOLD_BIT: PA1
|
* A1: CONTROL_FEED_HOLD_BIT: PA1
|
||||||
|
@ -195,6 +195,7 @@ static void GPIO_InitSystem(void)
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||||
|
|
||||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
|
// Safety door
|
||||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
|
||||||
|
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,8 @@
|
||||||
#define GPIO_SPINDLE_ENA_PIN GPIO_Pin_7
|
#define GPIO_SPINDLE_ENA_PIN GPIO_Pin_7
|
||||||
|
|
||||||
// Safety door
|
// Safety door
|
||||||
#define GPIO_DOOR_PORT GPIOB
|
#define GPIO_DOOR_PORT GPIOC
|
||||||
#define GPIO_DOOR_PIN GPIO_Pin_8
|
#define GPIO_DOOR_PIN GPIO_Pin_2
|
||||||
|
|
||||||
// Control pins
|
// Control pins
|
||||||
#define GPIO_CTRL_RST_PORT GPIOA
|
#define GPIO_CTRL_RST_PORT GPIOA
|
||||||
|
|
|
@ -281,7 +281,7 @@ void SysTick_Handler(void)
|
||||||
MC_UpdateSyncMove();
|
MC_UpdateSyncMove();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gMillis%25 == 0)
|
if(gMillis%32 == 0)
|
||||||
{
|
{
|
||||||
// 25ms Task (min 7 RPM)
|
// 25ms Task (min 7 RPM)
|
||||||
uint16_t cnt = (uint16_t)Encoder_GetValue();
|
uint16_t cnt = (uint16_t)Encoder_GetValue();
|
||||||
|
@ -299,7 +299,7 @@ void SysTick_Handler(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate RPM and smooth it
|
// Calculate RPM and smooth it
|
||||||
float rpm = ((cnt_diff * 40.0) / PULSES_PER_REV) * 60.0;
|
float rpm = ((cnt_diff * 31.25) / PULSES_PER_REV) * 60.0;
|
||||||
rpm_arr[rpm_idx++] = (uint32_t)rpm;
|
rpm_arr[rpm_idx++] = (uint32_t)rpm;
|
||||||
if(rpm_idx > (RPM_FILTER_NUM-1))
|
if(rpm_idx > (RPM_FILTER_NUM-1))
|
||||||
{
|
{
|
||||||
|
|
24
Makefile
24
Makefile
|
@ -32,11 +32,22 @@ SOURCES := ./ ARM/cmsis/ grbl/ HAL/ HAL/EXTI HAL/FLASH HAL/GPIO HAL/I2C HAL/SPI
|
||||||
|
|
||||||
INCLUDES := $(SOURCES) ARM/SPL/inc
|
INCLUDES := $(SOURCES) ARM/SPL/inc
|
||||||
|
|
||||||
LD_FILE = stm32f411re_flash.ld
|
# STM32 F446
|
||||||
DEFINES = -DSTM32F411xE -DSTM32F411RE
|
ifeq ($(target),F446)
|
||||||
|
LD_FILE = stm32f446re_flash.ld
|
||||||
#LD_FILE = stm32f446re_flash.ld
|
DEFINES = -DSTM32F446xx -DSTM32F446RE
|
||||||
#DEFINES = -DSTM32F446xx -DSTM32F446RE
|
TARGET_STR = "STM32 F446"
|
||||||
|
# STM32 F411
|
||||||
|
else ifeq ($(target),F411)
|
||||||
|
LD_FILE = stm32f411re_flash.ld
|
||||||
|
DEFINES = -DSTM32F411xE -DSTM32F411RE
|
||||||
|
TARGET_STR = "STM32 F411"
|
||||||
|
else
|
||||||
|
# Default Target
|
||||||
|
LD_FILE = stm32f446re_flash.ld
|
||||||
|
DEFINES = -DSTM32F446xx -DSTM32F446RE
|
||||||
|
TARGET_STR = "STM32 F446"
|
||||||
|
endif
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
|
@ -110,8 +121,9 @@ export OUTPUT := $(CURDIR)/$(TARGET)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
all:
|
all:
|
||||||
|
@echo "Building "$(TARGET_STR)"..."
|
||||||
@[ -d $(BUILD) ] || mkdir -p $(BUILD)
|
@[ -d $(BUILD) ] || mkdir -p $(BUILD)
|
||||||
@make --no-print-directory -C $(BUILD) $(OUTPUT).elf $(OUTPUT).bin $(OUTPUT).hex $(OUTPUT).lst -f $(CURDIR)/Makefile -j3
|
@make --no-print-directory -C $(BUILD) $(OUTPUT).elf $(OUTPUT).bin $(OUTPUT).hex $(OUTPUT).lst -f $(CURDIR)/Makefile -j4
|
||||||
@$(SIZE) $(OUTPUT).elf
|
@$(SIZE) $(OUTPUT).elf
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
|
@ -98,7 +98,12 @@ sudo apt install build-essential stlink-tools
|
||||||
* Clone repository and run following commands:
|
* Clone repository and run following commands:
|
||||||
```
|
```
|
||||||
make clean
|
make clean
|
||||||
make all flash
|
|
||||||
|
# Choose a target
|
||||||
|
make target=F446
|
||||||
|
make target=F411
|
||||||
|
|
||||||
|
make flash
|
||||||
```
|
```
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
#define GRBL_VERSION "1.1i"
|
#define GRBL_VERSION "1.1j"
|
||||||
#define GRBL_VERSION_BUILD __DATE__
|
#define GRBL_VERSION_BUILD __DATE__
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||||
Copyright (c) 2018-2020 Patrick F.
|
Copyright (c) 2018-2024 Patrick F.
|
||||||
|
|
||||||
Grbl-Advanced is free software: you can redistribute it and/or modify
|
Grbl-Advanced is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||||
Copyright (c) 2017-2020 Patrick F.
|
Copyright (c) 2017-2024 Patrick F.
|
||||||
|
|
||||||
Grbl-Advanced is free software: you can redistribute it and/or modify
|
Grbl-Advanced is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -48,15 +48,15 @@ static uint8_t dir_negative[N_AXIS] = {DIR_NEGATIV};
|
||||||
static uint8_t backlash_enable = 0;
|
static uint8_t backlash_enable = 0;
|
||||||
|
|
||||||
// Sync move
|
// Sync move
|
||||||
int32_t pos_z = 0;
|
static int32_t pos_z = 0;
|
||||||
static volatile uint8_t wait_spindle = 0;
|
static volatile uint8_t wait_spindle = 0;
|
||||||
static uint8_t start_sync = 0;
|
static uint8_t start_sync = 0;
|
||||||
static uint16_t enc_cnt_prev = 0;
|
static uint16_t enc_cnt_prev = 0;
|
||||||
static uint32_t EncValue = 0;
|
static uint32_t EncValue = 0;
|
||||||
static float sync_pitch = 0.0;
|
static float sync_pitch = 0.0;
|
||||||
|
|
||||||
float in = 0.0, out = 0.0, set = 0.0;
|
static float in = 0.0, out = 0.0, set = 0.0;
|
||||||
PID_t pid;
|
static PID_t pid;
|
||||||
|
|
||||||
|
|
||||||
void MC_Init(void)
|
void MC_Init(void)
|
||||||
|
@ -78,7 +78,7 @@ void MC_Init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
PID_Create(&pid, &in, &out, &set, 1.8, 22, 0.08);
|
PID_Create(&pid, &in, &out, &set, 1.8, 22, 0.08);
|
||||||
PID_Limits(&pid, -0.4, 0.4);
|
PID_Limits(&pid, -0.7, 0.7);
|
||||||
PID_EnableAuto(&pid);
|
PID_EnableAuto(&pid);
|
||||||
|
|
||||||
pos_z = 0;
|
pos_z = 0;
|
||||||
|
@ -262,18 +262,7 @@ void MC_LineSync(float *target, Planner_LineData_t *pl_data, float pitch)
|
||||||
|
|
||||||
sync_pitch = pitch;
|
sync_pitch = pitch;
|
||||||
|
|
||||||
if(pitch < 1.1)
|
PID_Tune(&pid, 20, 130.0, 0.0);
|
||||||
{
|
|
||||||
PID_Tune(&pid, 1.8, 22, 0.08);
|
|
||||||
}
|
|
||||||
else if(pitch < 1.6)
|
|
||||||
{
|
|
||||||
PID_Tune(&pid, 1.6, 18, 0.06);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PID_Tune(&pid, 1.4, 15, 0.04);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable feed override
|
// Disable feed override
|
||||||
sys.f_override = DEFAULT_FEED_OVERRIDE;
|
sys.f_override = DEFAULT_FEED_OVERRIDE;
|
||||||
|
@ -395,9 +384,6 @@ void MC_UpdateSyncMove(void)
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
Stepper_Ovr(out);
|
Stepper_Ovr(out);
|
||||||
|
|
||||||
/*Printf("err %d\r\n", (int)(1000*in));
|
|
||||||
Printf_Flush();*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,12 +56,13 @@
|
||||||
// Level 1 cutoff frequency and up to as fast as the CPU allows (over 30kHz in limited testing).
|
// Level 1 cutoff frequency and up to as fast as the CPU allows (over 30kHz in limited testing).
|
||||||
// NOTE: AMASS cutoff frequency multiplied by ISR overdrive factor must not exceed maximum step frequency.
|
// NOTE: AMASS cutoff frequency multiplied by ISR overdrive factor must not exceed maximum step frequency.
|
||||||
// NOTE: Current settings are set to overdrive the ISR to no more than 16kHz, balancing CPU overhead
|
// NOTE: Current settings are set to overdrive the ISR to no more than 16kHz, balancing CPU overhead
|
||||||
// and timer accuracy. Do not alter these settings unless you know what you are doing.
|
// and timer accuracy. Do not alter these settings unless you know what you are doing.
|
||||||
#define MAX_AMASS_LEVEL 3
|
#define MAX_AMASS_LEVEL 4
|
||||||
// AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.
|
// AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.
|
||||||
#define AMASS_LEVEL1 (uint32_t)(F_TIMER_STEPPER/8000) // Over-drives ISR (x2). Defined as F_CPU/(Cutoff frequency in Hz)
|
#define AMASS_LEVEL1 (uint32_t)(F_TIMER_STEPPER / 8000) // Over-drives ISR (x2). Defined as F_CPU/(Cutoff frequency in Hz)
|
||||||
#define AMASS_LEVEL2 (uint32_t)(F_TIMER_STEPPER/4000) // Over-drives ISR (x4)
|
#define AMASS_LEVEL2 (uint32_t)(F_TIMER_STEPPER / 4000) // Over-drives ISR (x4)
|
||||||
#define AMASS_LEVEL3 (uint32_t)(F_TIMER_STEPPER/2000) // Over-drives ISR (x8)
|
#define AMASS_LEVEL3 (uint32_t)(F_TIMER_STEPPER / 2000) // Over-drives ISR (x8)
|
||||||
|
#define AMASS_LEVEL4 (uint32_t)(F_TIMER_STEPPER / 1000) // Over-drives ISR (x16)
|
||||||
|
|
||||||
#if MAX_AMASS_LEVEL <= 0
|
#if MAX_AMASS_LEVEL <= 0
|
||||||
error "AMASS must have 1 or more levels to operate correctly."
|
error "AMASS must have 1 or more levels to operate correctly."
|
||||||
|
@ -71,6 +72,7 @@
|
||||||
#define STEP_TIMER_MIN (uint16_t)(F_TIMER_STEPPER / MAX_STEP_RATE_HZ)
|
#define STEP_TIMER_MIN (uint16_t)(F_TIMER_STEPPER / MAX_STEP_RATE_HZ)
|
||||||
#else
|
#else
|
||||||
#define STEP_TIMER_MIN (uint16_t)((F_TIMER_STEPPER / 120000))
|
#define STEP_TIMER_MIN (uint16_t)((F_TIMER_STEPPER / 120000))
|
||||||
|
#pragma message("Max stepper rate: 120KHz")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define G96_UPDATE_CNT 20
|
#define G96_UPDATE_CNT 20
|
||||||
|
@ -1363,10 +1365,14 @@ void Stepper_PrepareBuffer(void)
|
||||||
{
|
{
|
||||||
prep_segment->amass_level = 2;
|
prep_segment->amass_level = 2;
|
||||||
}
|
}
|
||||||
else
|
else if (cycles < AMASS_LEVEL4)
|
||||||
{
|
{
|
||||||
prep_segment->amass_level = 3;
|
prep_segment->amass_level = 3;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prep_segment->amass_level = 4;
|
||||||
|
}
|
||||||
|
|
||||||
cycles >>= prep_segment->amass_level;
|
cycles >>= prep_segment->amass_level;
|
||||||
prep_segment->n_step <<= prep_segment->amass_level;
|
prep_segment->n_step <<= prep_segment->amass_level;
|
||||||
|
|
2
main.c
2
main.c
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||||
Copyright (c) 2018-2020 Patrick F.
|
Copyright (c) 2018-2024 Patrick F.
|
||||||
|
|
||||||
Grbl-Advanced is free software: you can redistribute it and/or modify
|
Grbl-Advanced is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
Ładowanie…
Reference in New Issue