1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-03 03:13:25 +02:00

Added RMT Step Generation as an option

- Uncomment #define USE_RMT_STEPS in config.h to use RMT based steps
- You can also use #define STEP_PULSE_DELAY 10 in config.h now
This commit is contained in:
bdring
2019-04-24 17:37:53 -05:00
parent d8c4545fe5
commit 228e79835d
4 changed files with 975 additions and 759 deletions

View File

@@ -49,6 +49,7 @@ Some features should not be changed. See notes below.
#define CPU_MAP_ESP32 // these are defined in cpu_map.h
#define VERBOSE_HELP // adds addition help info, but could confuse some senders
// Serial baud rate
#define BAUD_RATE 115200
@@ -501,6 +502,15 @@ Some features should not be changed. See notes below.
// time step. Also, keep in mind that the Arduino delay timer is not very accurate for long delays.
#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds)
// For test use only. This uses the ESP32's RMT perifieral to generate step pulses
// It allows the use of the STEP_PULSE_DELAY (see below) and it automatically ends the
// pulse in one operation.
// Dir Pin ____|--------------------
// Step Pin _______|--|____________
// While this is experimental, it is intended to be the future default method after testing
//#define USE_RMT_STEPS
// Creates a delay between the direction pin setting and corresponding step pulse by creating
// another interrupt (Timer2 compare) to manage it. The main Grbl interrupt (Timer1 compare)
// sets the direction pins, and does not immediately set the stepper pins, as it would in
@@ -510,8 +520,8 @@ Some features should not be changed. See notes below.
// NOTE: Uncomment to enable. The recommended delay must be > 3us, and, when added with the
// user-supplied step pulse time, the total time must not exceed 127us. Reported successful
// values for certain setups have ranged from 5 to 20us.
// !!!!! ESP32 Not currently implemented
// #define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
// must use #define USE_RMT_STEPS for this to work
//#define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
// The number of linear motions in the planner buffer to be planned at any give time. The vast
// majority of RAM that Grbl uses is based on this buffer size. Only increase if there is extra

View File

@@ -35,7 +35,9 @@
with AVR grbl
*/
#ifdef CPU_MAP_ESP32
// This is the CPU Map for the ESP32 CNC Controller R2
@@ -43,13 +45,17 @@
// won't affect operation except that there will be no output
// form the pins. Grbl will virtually move the axis. This could
// be handy if you are using a servo, etc. for another axis.
#define X_STEP_PIN GPIO_NUM_12
#define Y_STEP_PIN GPIO_NUM_14
#define Z_STEP_PIN GPIO_NUM_27
#define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_26
#define X_RMT_CHANNEL 0
#define X_DIRECTION_PIN GPIO_NUM_26
#define Y_DIRECTION_PIN GPIO_NUM_25
#define Z_DIRECTION_PIN GPIO_NUM_33
#define Y_STEP_PIN GPIO_NUM_14
#define Y_DIRECTION_PIN GPIO_NUM_25
#define Y_RMT_CHANNEL 1
#define Z_STEP_PIN GPIO_NUM_27
#define Z_DIRECTION_PIN GPIO_NUM_33
#define Z_RMT_CHANNEL 2
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
@@ -851,4 +857,3 @@
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -82,6 +82,8 @@ extern uint8_t ganged_mode;
void IRAM_ATTR onSteppertimer();
void IRAM_ATTR onStepperOffTimer();
void stepper_init();
void initRMT();
inline IRAM_ATTR static void stepperRMT_Outputs();
// Enable steppers, but cycle does not start unless called by motion control or realtime command.
void st_wake_up();