Skip to content
This repository

Update Marlin/stepper.cpp #160

Closed
wants to merge 1 commit into from

2 participants

JTrantow daid
JTrantow

The original Marlin firmware sends out a step pulse by toggling the _STEP_PIN high then immediately low resulting in a 1.4usec pulse.
A Pololu A4988 with a 1usec pulse width requirement which works fine.
However, other stepper drivers use a TB6560AHQ with a 30usec requirement. (No wonder it won't work at <1.4usec.)

By comparison, Teacup firmware has a step pulse width of 60usec.
The Marlin firmware stepper.c file has been modified to set the _STEP_PINs low a little later in the code.
This alone extends the step pulse to approx 10usec.
Define the EXTEND_STEP_PULSE_USEC macro to extend the step pulses. (This is only applied to the XYZ steppers.)
Stepper interrupt gives a step pulse period = 10 usec plus this value to the XYZ steppers.

daid
Collaborator

This patch no longer fits on the current code.

daid daid closed this November 06, 2012
JTrantow

I don't understand why the patch no longer fits on the current code. The overhead is a one function call to delayMicroseconds() which is only incurred when this option is needed. The current implementation has a very fragile step pulse that is not compatible with some of the least expensive drivers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

May 04, 2012
JTrantow Update Marlin/stepper.cpp 2edb383
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 13 additions and 3 deletions. Show diff stats Hide diff stats

  1. 16  Marlin/stepper.cpp
16  Marlin/stepper.cpp
@@ -453,7 +453,6 @@ ISR(TIMER1_COMPA_vect)
453 453
       if (counter_x > 0) {
454 454
         WRITE(X_STEP_PIN, HIGH);
455 455
         counter_x -= current_block->step_event_count;
456  
-        WRITE(X_STEP_PIN, LOW);
457 456
         count_position[X_AXIS]+=count_direction[X_AXIS];   
458 457
       }
459 458
 
@@ -461,7 +460,6 @@ ISR(TIMER1_COMPA_vect)
461 460
       if (counter_y > 0) {
462 461
         WRITE(Y_STEP_PIN, HIGH);
463 462
         counter_y -= current_block->step_event_count;
464  
-        WRITE(Y_STEP_PIN, LOW);
465 463
         count_position[Y_AXIS]+=count_direction[Y_AXIS];
466 464
       }
467 465
 
@@ -469,7 +467,6 @@ ISR(TIMER1_COMPA_vect)
469 467
       if (counter_z > 0) {
470 468
         WRITE(Z_STEP_PIN, HIGH);
471 469
         counter_z -= current_block->step_event_count;
472  
-        WRITE(Z_STEP_PIN, LOW);
473 470
         count_position[Z_AXIS]+=count_direction[Z_AXIS];
474 471
       }
475 472
 
@@ -483,6 +480,19 @@ ISR(TIMER1_COMPA_vect)
483 480
         }
484 481
       #endif //!ADVANCE
485 482
       step_events_completed += 1;  
  483
+      
  484
+      /*
  485
+        Turn off all steps (even if only one is active).
  486
+        This will lengthen out the step pulse width.
  487
+        Additional delay can be compiled in using EXTEND_STEP_PULSE_USEC.
  488
+      */  
  489
+      #if defined(EXTEND_STEP_PULSE_USEC)
  490
+        delayMicroseconds(EXTEND_STEP_PULSE_USEC);
  491
+      #endif
  492
+      WRITE(X_STEP_PIN, LOW);
  493
+      WRITE(Y_STEP_PIN, LOW);
  494
+      WRITE(Z_STEP_PIN, LOW);
  495
+
486 496
       if(step_events_completed >= current_block->step_event_count) break;
487 497
     }
488 498
     // Calculare new timer value
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.