From edfcf3b52778456e109b9728b1a89d1ba62c33c6 Mon Sep 17 00:00:00 2001 From: Bo Herrmannsen Date: Wed, 3 Dec 2014 15:01:52 +0100 Subject: [PATCH] Toshiba Stepper Driver support Tosh stepper drivers need to be driven slower, so the stepper code was interleaved to separate the pin HIGH from the pin LOW. This adds enough instructions to make it work, without needing nops. --- Marlin/stepper.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 9e22eb198b..b2e7d12080 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -559,6 +559,58 @@ ISR(TIMER1_COMPA_vect) #endif //ADVANCE counter_x += current_block->steps_x; + #ifdef CONFIG_STEPPERS_TOSHIBA + /* The toshiba stepper controller require much longer pulses + * tjerfore we 'stage' decompose the pulses between high, and + * low instead of doing each in turn. The extra tests add enough + * lag to allow it work with without needing NOPs */ + if (counter_x > 0) { + WRITE(X_STEP_PIN, HIGH); + } + + counter_y += current_block->steps_y; + if (counter_y > 0) { + WRITE(Y_STEP_PIN, HIGH); + } + + counter_z += current_block->steps_z; + if (counter_z > 0) { + WRITE(Z_STEP_PIN, HIGH); + } + + #ifndef ADVANCE + counter_e += current_block->steps_e; + if (counter_e > 0) { + WRITE_E_STEP(HIGH); + } + #endif //!ADVANCE + + if (counter_x > 0) { + counter_x -= current_block->step_event_count; + count_position[X_AXIS]+=count_direction[X_AXIS]; + WRITE(X_STEP_PIN, LOW); + } + + if (counter_y > 0) { + counter_y -= current_block->step_event_count; + count_position[Y_AXIS]+=count_direction[Y_AXIS]; + WRITE(Y_STEP_PIN, LOW); + } + + if (counter_z > 0) { + counter_z -= current_block->step_event_count; + count_position[Z_AXIS]+=count_direction[Z_AXIS]; + WRITE(Z_STEP_PIN, LOW); + } + + #ifndef ADVANCE + if (counter_e > 0) { + counter_e -= current_block->step_event_count; + count_position[E_AXIS]+=count_direction[E_AXIS]; + WRITE_E_STEP(LOW); + } + #endif //!ADVANCE +#else if (counter_x > 0) { #ifdef DUAL_X_CARRIAGE if (extruder_duplication_enabled){ @@ -635,6 +687,7 @@ ISR(TIMER1_COMPA_vect) WRITE_E_STEP(INVERT_E_STEP_PIN); } #endif //!ADVANCE + #endif step_events_completed += 1; if(step_events_completed >= current_block->step_event_count) break; }