MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.17k stars 19.21k forks source link

Extruder working fine with A4988s, not with DRV8825, repetier works, marlin not #975

Closed yellobello closed 9 years ago

yellobello commented 10 years ago

Hi, I did this post on the reprap forum, but after a couple of posts nobody seems to find an answer for this strange behaviour:

http://forums.reprap.org/read.php?13,358655,373531#msg-373531

The thing is that I can´t get DRV8825 driver working with my RAMPS board, but JUST for the EXTRUDER. XYZ are working fine with the DRVs but not E0. I tried everything, swapping drivers, swapping stepper motors, nothing. The only thing that helped was switching from Marlin to Repetier, and all of a sudden it worked. So I asssume It´s Marlin related.... maybe the step width? Where on Marlin can this be set? Any other ideas why it´s not working?

Zikoel commented 10 years ago

I have the same problem! With my logic analizer I have see that Marlin shoot out very little peak for control the driver. Maybe they are too little??

nothinman commented 10 years ago

@yellobello what is happening exactly? no movement, vibration, skipping steps?

I'm using DRV8825 (or DRV8824) on all axes, and it's working as expected.

The difference between the drivers, except the obvious micro stepping, are the timings. DRV8824/5 requires, if I remember correctly, 2x longer pulses compared to A49xx drivers.

Marcin

yellobello commented 10 years ago

When I heat up my hotend and extrude some filament, all that I get is some sounds from the stepper when trimming the pot, but not a single step(at least not one I noticed) At one very fine potentiometer setting I can see an attempt of the motor to move, but when I turn the pot one degree further it starts just making sound again.... Somewhere I read that I should raise the step time from around 1ms to 1.9ms, but where can I do this on marlin??

justmyopinion commented 10 years ago

Be sure you have a deasant speed setting in configuration.h

define DEFAULT_MAX_FEEDRATE {250, 250, 4, 30} // (mm/sec) or whatever.....

Be sure your direction is correct so you are not retracting when extruding is expected.

define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set false

Or check this in configuration_adv.h: //By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.

define INVERT_X_STEP_PIN false

define INVERT_Y_STEP_PIN false

define INVERT_Z_STEP_PIN false

define INVERT_E_STEP_PIN false

yellobello commented 10 years ago

Hi,

There is definately something wrong here. I don't know if it's marlin or the steper drivers, but since everything works on repetier, my guess would be marlin. A little deeper guess is that it is somehow connected to the way marlin pulses the steppers. (pulse time width?)

Afte playing arround with the speed a little I finally got all of them working, but then another issue emerged, which is VERY strange.

Sometimes, mainly after homing or doing a G29, it happens that stepper motors that definately should not move at the moment do move, and this with the steps that are clearly meant for another motor. Example: I had my x-axis moving together with my extruder, and the axis did exactly the same steps that the extruder did. Also, My Y axis moved together with the Z-axis, somehow getting the steps that are clearly meant for the Z-Motors. Again, Repetier FW working fine. Swapping to A4988s again solved the issue COMPLETELY. No wrong wiring involved. trust me.

So the DRV8825s are promoted as plug-in replacements, and for me they are clearly not. They behave very sensitive on the way they are pulsed, and my problems only occur with marlin.

As I found out, Marlin has no official way to alter pulse width... but I love to try arround with this in order to be sure that this is not the problem. Any suggestions? My idea was to add a delay after every digital write to the pin, but not sure if that is OK...

nophead commented 10 years ago

From Pololu's site:

With the DRV8825, the high and low STEP pulses must each be at least 1.9 us; they can be as short as 1 us when using the A4988.

So they are not plug in replacements. You would need to add delays before the digital writes that set the step signal inactive.

I can't explain why the wrong motors are stepping though.

yellobello commented 10 years ago

Example:

  for(unsigned char i=0; i<4;i++) {
      if (e_steps[0] != 0) {
        WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);
        delayMicroseconds(2);
        if (e_steps[0] < 0) {
          WRITE(E0_DIR_PIN, INVERT_E0_DIR);
          e_steps[0]++;
          WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
        }
        else if (e_steps[0] > 0) {
          WRITE(E0_DIR_PIN, !INVERT_E0_DIR);
          e_steps[0]--;
          WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
        }
      }

This goes only for the extruder E0, so I ASSUME that

WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);

gives a HIGH signal while

WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);

gives a LOW, right?

And I only need this for STEP_PIN, not DIR_PIN....

yellobello commented 10 years ago

Oh, I just saw that both HIGH and LOW need to be longer, so:

for(unsigned char i=0; i if (e_steps[0] != 0) {
WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);
delayMicroseconds(2);
if (e_steps[0] WRITE(E0_DIR_PIN, INVERT_E0_DIR);
delayMicroseconds(2);
e_steps[0]++;
WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
delayMicroseconds(2);
}
else if (e_steps[0] > 0) {
WRITE(E0_DIR_PIN, !INVERT_E0_DIR);
e_steps[0]--;
WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
delayMicroseconds(2);
}
}
nophead commented 10 years ago

The DIR pin needs to obey the setup time, which is only 650ns. I.e. it has to be set 650ns before the start of the step pulse. You don't need a delay after the falling edge because there is all of the step period between each pulse.

Please put triple back quotes around you code snippets to make it readable.

nothinman commented 10 years ago

I didn't respond earlier, as this was, I am pretty sure, already implemented. Unfortunately I can't find it in the code. I remember there was a define called STEPPER_DELAY or something similar... But I no longer see it anywhere. I'm 99% sure I've personally merged this code a few months ago. Perhaps it's been overwritten. Will check my copy at home, as I am using DRV8824/25 drivers (with Sanguinololu).

Martin

yellobello commented 10 years ago

So I guess It won't be a big deal to re-implement :-)

thanks!!

louhyder commented 10 years ago

Greetings everyone, I have some trouble navigating on this site. If anyone could help me, it would be much appreciated. I just need to know if the Marlin firmware https://github.com/ErikZalm/Marlin/tree/Marlin_v1, supports dual extruder printer. Otherwise, could anyone assist me in getting the firmware that does? Thank you so much for your cooperation. Cheers Hyder

yellobello commented 10 years ago

Indeed, you are a bit at the wrong place in this thread. If you want to know a bit a bout dual extruding go to the reprap forum at repap.org, the chat or the wiki. Take a look into marlins config files, bascally it's just E0, E1, E2, and the corresponding offsets that you need to put accordingly.

Any news on the lost variable? I played around with some delay values that I put manually in the code and my impression is that it gets better. However, I rather have a professional solution like nothinman's :-)

Nothinman, you say that you use the TI chips as well, did you also notice some problems, or did you just add the code to be on the safe side, as the datasheet suggests?

trilitheum commented 10 years ago

Hi, I can confirm that something is amiss with the DRV8825's and the current firmware, just swapped in new 8825's, X, Y, Z, did manage to move but nothing from the extruder stepper at all. Coil current was set the same as with my 4988's. The whine (even at low current settings) from the DRV8825's was quite bad, I am not sure if this is from the step pulse issue, or inherent to the DRV8825, but it was significant. Any further updates on this issue?

justmyopinion commented 10 years ago

It has no meaning whatsoever that your problems should be affecting Extruder motor only, so I think your problems should be found elsewhere and probably speed or direction related with E0 drive. I have been using DRV8825 for a long time with numerous versions of latest marlin FW and never seen this issue so I find it hard to believe this is fw related. a lot of params could change values going from Repetier to Marlin.

trilitheum commented 10 years ago

When I did the swap last night I changed nothing but the steps/mm to be correct with the 1/32 micostepping. Set the coil current the same, then tried to move the axis, all worked except the extruder, even with no filament it wouldn't turn. Tried backing the speed down, speed up, current up, current down, changed direction, the extruder stepper would not step at all. These are the DRV8825's with the revised PCB which has the pull up resistor added to make them active without modiciation. Is it possible you have the first revision PCB? Could there be a difference?

nophead commented 10 years ago

Note that chips vary from batch to batch. The datasheet will give the worst case pulse width that is guaranteed to work. If the pulses are too short they may work on some chips and not others and may depend on supply voltage and temperature.

amramsey commented 10 years ago

Sounds like the extruder isn't running because you have temperature protection enabled in Marlin... it reads the temperature and decides it isn't safe to run the extruder when it is under temp.

Aaron

trilitheum commented 10 years ago

The extruder was up to temp, that was ok. I swapped out two of the other DRV8825's from the X and Y axis which were running thoes axis ok, and they would not run on the extruder channel. It would vibrate as before but wouldn't move. I changed nothing in the firmware, powered down, swapped the A4988's back in, powered up, and it worked no problems all channels.

justmyopinion commented 10 years ago

Cold extrudes can be enabled by Gcode command M302, give it a try!

trilitheum commented 10 years ago

I also still can't believe the whine that comes out of these things, do you guys who have been running the DRV8825's with no problems have this high pitch whine with them?

nophead commented 10 years ago

The board probably has the wrong component values for the motor you are using. The chopper frequency should be ultrasonic but it seems yours is in audible range.

trilitheum commented 10 years ago

That's unfortunate, even if the extruder channel issue gets worked out I am not sure I can stand the whine. I was hoping it could be a result of the incompatible pulse width. The interesting thing is all the channels appear to whine, but the extruder stepper is a completely different make, slightly higher torque stepper, than the X Y Z axis Japan servo steppers. It would be interesting to see if the DRV8825 has the same behaviour in a different carrier, such as the Azteeg X5 compared to the RAMPS, but that's an expensive experiement...

trilitheum commented 10 years ago

I have been looking through the code to try and find if there is somewhere to change the step signal rate to try and see if that is the issue for my particular DRV8825's, as it looks like some are running them without problems.

I can confirm with no changes to firmware, nozzle is still hot, just back to back swapping of the A4988's the extruder works no problem, I know nothinman commented about a STEPPER_DELAY define several days ago, any ideas?

yellobello commented 10 years ago

The first thing someone pointed out to me was also that I would do a cold extrude. Which was of course not the case.

It seems that the issue is not with all DRV8825s, however I also tried some from GE tech and some from sainsmart, and both had the same issues. Switching the firmware to repetier and the problem is gone, switching to A4988s and the problem is gone, so It must have something to do with how marlin controls the steppers.

Keeping in mind that people are going to use finer microstepping (eric uses 128th microstepping on marlin2 board, I think) in the future and other stepper drivers, this is something that clearly should be adressed. Its good to have the A4988s working well and MOST other drivers too, but since those issues exist, why not look into them? Unfortunately I don´t know much about those things :-( I have learned some, but my tries with delays as written above did not lead to satisfying results.

yellobello commented 10 years ago

Hi! Any news on this one? Nothinman, you found the code?

;-)

jgrjgr commented 10 years ago

i have a version of marlin https://github.com/jgrjgr/Marlin which i've modified with a longer pulse width and is configurable, plus also hardware pwm capability, this version will also run with the tb6560 drivers as well

yellobello commented 10 years ago

Nice one, jgrjgr!

So what I found out is that you made this:

void step_wait(){ for(int8_t i=0; i < 6; i++){ delayMicroseconds(5); } }

and call It on every digital write to the step pin, right?

Any experience with good values to use?

Ssendog commented 10 years ago

Hello,

I just mounted a DRV8825 driver onto my RAMPS board and I found no problems with my extruder. I have a homemade 3D printer with a direct-drive extruder that havent enough torque to feed my filament. So I installed a new stepperdriver. Before I installed my new driver, Ive studied Pololu documentations and I find something that would ( maybe ) help you guys!

I noticed that: - nobody mentioned about the wiring schematics for your new driver DRV8825 to your bipolar motor.

example:

with the "old" driver ( A4988 ) you have 2 sets of wiring that energize your steppermotor. ==> 2B and 2A, Blue and red. and the others ==> 1A and 1B, green and black.

with the new Pololu driver ( DRV8825 ) you have also 2 sets of wiring. But different than above! take a look: ==> 1B and 2B, Blue and red. and the others ==> 1A and 2A, green and black.

Result: old driver wiring setting is not compatible with new one. So verify if your wiring is comform specification connected.

Because if your wiring is not properly connected to you hardware. Then it will cause a problem. Each motor has his 2 coils. And 1 coil has 2 wires = 2 x 2 =4 wires. Can you imagine when mixing up these wires? Nothing will happen. Steppermotor won`t do a thing.

Make sure: Pot-resistor is turned to a minimal. And make sure that: your jumper setting is set to FullStep for fine adjustments with your POT-resistor.

P.S: I`ve nothing changed in the firmware.

Works for me.

oysteinkrog commented 10 years ago

@jgrjgr Your fork is quite frankly a mess, I wanted to test your pulse width modifications but untangling your changes is.. not fun. If you want others to understand/use your changes please consider separating changes into their own commits.

jgrjgr commented 10 years ago

@oysteinkrog the line of interest in stepper.cpp is 243 which is where you set your time between steps. at this point i couldn't careless if anyone wants to understand/use my fork it's primarily there for me so I can stay up to date without having to redo all my modifications every time, there is no intention to actually bring in hardware pwm or the ability to define a pulse width into the mainstream version of marlin anyway this was made very clear many months ago, as far as i am aware i am the only one whose done this, i have no idea how to separate anything as you suggest , strictly speaking it's something short of a miracle i was able to even get my modified copy of marlin back up on to git-hub in the first place with this mickey mouse system

jgrjgr commented 10 years ago

@yellobello when i was using the tb6560 drivers i found anything over 10 microseconds was enough to make them behave and from what i remember just having even a delay or 1 microsecond was enough to make a difference as well which went a little bit against the datasheet, as i recall the tb6560's need 30microsecond pulse width, what i also did to another version at one point was to reduce the number of steps marlin cold make during a single interupt down to 1 which also helped with those drivers, i image with the drv8825s the current value will suffice , however it doesn't take much to change it and have a play

nicksears commented 9 years ago

What version of the driver do you have md20a or b?

Check the notice here about the A version (http://www.pololu.com/product/2132) and way to convert it to b here (http://www.soliforum.com/topic/4341/steppers-not-moving-in-any-direction-on-ramps-14/)

boelle commented 9 years ago

is this issue still present or did someone find the fix for it?

Silly105 commented 9 years ago

AFAIK this has not been fixed, but I can't test it.

boelle commented 9 years ago

ok, i have marked it a potential bug.... if someone test this let us know

nicksears commented 9 years ago

I have not been able to reproduce it with my setup (ramps 1.4, Chinese 8825 with different PCB, http://www.geeetech.com/stepstick-drv8825-stepper-motor-driver-carrier-reprap-4layer-pcb-p-652.html )

They work fine, but I'm using them in 1/16 mode and at ~60mm/s

boelle commented 9 years ago

maybe that could be the issue for those who have a problem?

boelle commented 9 years ago

please open a new issue if this is still present in the current bug fixing branch

https://github.com/ErikZalm/Marlin/tree/Marlin-v1-bug-fixing

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.