<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Marlin successive home issue</title>
        <description> Aye all,

I&#039;m new here. I work on a 3D printer (based on ramps 1.4 + Marlin) which prints drawings. So it&#039;s more like a pseudo-3D printer because drawing doesn&#039;t have thickness. 

For bring back on top the Z motor, I use the command G28 Z0 to home it because I don&#039;t have enought skill to write my own command to do something like that.

My issue is between two calls of G28, sometimes the gcode inside is not executed. The Gcode is well executed untill we reach these lines :

G28 Z0
G0 X-9.253807106598984 Y26.3502538071066
M12
M3
G1 X-0.5939086294416244 Y21.3502538071066 F250
G1 X-0.5939086294416244 Y11.350253807106599
G1 X-9.253807106598984 Y6.3502538071066
G1 X-17.913705583756347 Y11.350253807106599
G1 X-17.913705583756347 Y21.3502538071066
G1 X-9.253807106598984 Y26.3502538071066
M5
M13
G28 Z0
G0 X-7.894670050761421 Y-6.361167512690355
M12
M3
G1 X0.766497461928934 Y-11.360406091370558 F250
G1 X0.766497461928934 Y-21.360406091370557
G1 X-7.895939086294417 Y-26.360406091370557
G1 X-16.555837563451774 Y-21.360406091370557
G1 X-16.555837563451774 Y-11.360406091370558
G1 X-7.895939086294417 Y-6.3604060913705585
M5
M13
G28 Z0


There is approximately 10 lines between two calls. These lines are not executed. They are just ignored so we have a succession of home command. 

I noticed that the Gcode is well exectued when there is enought command between two calls (around 20 lines).

When there is enought command line between two calls, it works well again. It appears that there is a kind of delay between two calls.

If I have a question, it would be : is it a mistake to use the home command so many times ?

PS : sorry for my approximate english ^^&quot;</description>
        <link>https://reprap.org/forum/read.php?146,522641,522641#msg-522641</link>
        <lastBuildDate>Sat, 06 Jun 2026 16:20:42 -0400</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,523089#msg-523089</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,523089#msg-523089</link>
            <description><![CDATA[ @wes1007 : initially I had a variable which counted the number of steps but, the problem is, unlikely to home command, the program doesn't wait for the counter to reach 0. Typically, it just had time to make one step back before the next command is executed. That's why I use the home command for that.<br />
<br />
If I use this counter again, I would like to find a way to interrupt the program while a condition is not verified, and in that case, the counter equal 0.<br />
<br />
But, because there is always a but, even the tool drive the motor up and down, the firmware can do it too and in the same time. I explain, even we count the number of steps in order to come back to the initial position, nothing prevent the firmware (for any reason) to move the same motor. So the firmware will translate the original position and when the M13 command is executed, the motor won't step back at its original position.<br />
<br />
Using home command with an endstop provides a fixed point in the space. <br />
<br />
@Olaf : you are certainly right but for now it works so I'll see this later.]]></description>
            <dc:creator>Sodombar</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Thu, 18 Jun 2015 06:10:16 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522790#msg-522790</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522790#msg-522790</link>
            <description><![CDATA[ If you implemented this code snip into Marlin, IMHO  it is a bad idea to use the <u>delay</u> command.<br />
Because it freezes the cpu and it is not able to answer interrupts and other stuff during the delay.<br />
It is better to use a timer, but I´m not familiar with Marlin to say, which timer is not occupied already..<br />
-Olaf]]></description>
            <dc:creator>o_lampe</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 13:38:18 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522773#msg-522773</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522773#msg-522773</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Sodombar</strong><br />
The tool is a kind of sensor. <br />
<br />
 I use this function to drive the motor :<br />
<br />
// Takes a single step<br />
void takeSingleStep() {<br />
  Z_STEP_WRITE(LOW);<br />
  delayMicroseconds(stepPulseWidthInMicroSec);<br />
  Z_STEP_WRITE(HIGH);<br />
  delayMicroseconds(timeBetweenStepsInMicroSec);<br />
}<br />
<br />
In relation to the state of the sensor :<br />
<br />
// GO UP<br />
    if (state1 &lt; threshold &amp;&amp; state2 &gt;= threshold) {<br />
      Z_DIR_WRITE(HIGH);<br />
      takeSingleStep();<br />
<br />
    // GO DOWN<br />
    if (state2 &lt; threshold &amp;&amp; state1 &gt;= threshold) {<br />
      Z_DIR_WRITE(LOW);<br />
      takeSingleStep();<br />
<br />
<br />
In fact, the motor moves but return no information about its motion. Because, if it could return some informations about its position then it would be possible to use G0 Z0 as the motor is no longer at the position Z0.</div></blockquote>
<br />
Okay so why not add a variable in that counts the number of steps from the M12 command till it reaches the platform. Then when an M13 is issued it will go back up the same amount. and reset the counter back to 0. Im not brilliant with code  (else id have put all the bits in for you) and i dont have all your code to play with.]]></description>
            <dc:creator>wes1007</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 12:47:34 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522767#msg-522767</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522767#msg-522767</link>
            <description><![CDATA[ The tool is a kind of sensor. <br />
<br />
 I use this function to drive the motor :<br />
<br />
// Takes a single step<br />
void takeSingleStep() {<br />
  Z_STEP_WRITE(LOW);<br />
  delayMicroseconds(stepPulseWidthInMicroSec);<br />
  Z_STEP_WRITE(HIGH);<br />
  delayMicroseconds(timeBetweenStepsInMicroSec);<br />
}<br />
<br />
In relation to the state of the sensor :<br />
<br />
// GO UP<br />
    if (state1 &lt; threshold &amp;&amp; state2 &gt;= threshold) {<br />
      Z_DIR_WRITE(HIGH);<br />
      takeSingleStep();<br />
<br />
    // GO DOWN<br />
    if (state2 &lt; threshold &amp;&amp; state1 &gt;= threshold) {<br />
      Z_DIR_WRITE(LOW);<br />
      takeSingleStep();<br />
<br />
<br />
In fact, the motor moves but return no information about its motion. Because, if it could return some informations about its position then it would be possible to use G0 Z0 as the motor is no longer at the position Z0.]]></description>
            <dc:creator>Sodombar</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 12:38:09 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522747#msg-522747</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522747#msg-522747</link>
            <description><![CDATA[ So how does this tool determine when it is on the surface? How does it drive the stepper motor? What is the tool?]]></description>
            <dc:creator>wes1007</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 11:59:51 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522718#msg-522718</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522718#msg-522718</link>
            <description><![CDATA[ @o_lampe : Here is the beginning of the Gcode file :<br />
G28 Z0<br />
M12<br />
M3<br />
G0 X-63.569035532994924 Y0.2878172588832487<br />
G2 X-63.21065989847716 Y2.230964467005076 I5.449238578680204 J0 F250<br />
G2 X-62.10406091370558 Y4.126903553299492 I6.2944162436548226 J-2.4010152284263957<br />
G2 X-60.464467005076145 Y5.675126903553299 I7.114213197969543 J-5.893401015228426<br />
G2 X-57.71065989847716 Y7.3578680203045685 I11.225888324873097 J-15.258883248730966<br />
G2 X-51.65736040609137 Y9.459390862944163 I11.076142131979696 J-22.15228426395939<br />
G2 X-43.568527918781726 Y10.286802030456851 I8.088832487309645 J-39.055837563451774<br />
G2 X-35.47969543147208 Y9.459390862944163 I0 J-39.88324873096447<br />
G2 X-29.426395939086298 Y7.3578680203045685 I-5.022842639593908 J-24.253807106598984<br />
G2 X-26.67258883248731 Y5.675126903553299 I-8.472081218274111 J-16.941624365482234<br />
G2 X-25.03299492385787 Y4.126903553299492 I-5.474619289340101 J-7.441624365482234<br />
G2 X-23.926395939086294 Y2.230964467005076 I-5.187817258883248 J-4.2969543147208125<br />
G2 X-23.568527918781726 Y0.2868020304568528 I-5.091370558375634 J-1.9416243654822334<br />
G2 X-23.926395939086294 Y-1.6548223350253808 I-5.449238578680204 J0<br />
G2 X-25.03299492385787 Y-3.550761421319797 I-6.2944162436548226 J2.4010152284263957<br />
G2 X-26.67258883248731 Y-5.098984771573604 I-7.114213197969543 J5.893401015228426<br />
G2 X-29.426395939086298 Y-6.784263959390863 I-11.225888324873097 J15.258883248730966<br />
G2 X-35.47969543147208 Y-8.883248730964468 I-11.076142131979696 J22.15228426395939<br />
G2 X-43.568527918781726 Y-9.713197969543147 I-8.088832487309645 J39.055837563451774<br />
G2 X-51.65736040609137 Y-8.883248730964468 I0 J39.88324873096447<br />
G2 X-57.71065989847716 Y-6.784263959390863 I5.022842639593908 J24.253807106598984<br />
G2 X-60.464467005076145 Y-5.098984771573604 I8.472081218274111 J16.941624365482234<br />
G2 X-62.10406091370558 Y-3.550761421319797 I5.474619289340101 J7.441624365482234<br />
G2 X-63.21065989847716 Y-1.6548223350253808 I5.187817258883248 J4.2969543147208125<br />
G2 X-63.568527918781726 Y0.2868020304568528 I5.091370558375634 J1.9416243654822334<br />
M5<br />
M13<br />
G28 Z0<br />
<br />
<br />
Negative coordinates don't seem to be a problem for the execution.]]></description>
            <dc:creator>Sodombar</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 11:04:42 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522700#msg-522700</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522700#msg-522700</link>
            <description><![CDATA[ Both segments that doesn´t get printed/painted have negative ccordinates.<br />
<br />
Usually the firmware ignores all commands with values below "0" unless you allow it.<br />
<br />
Lines 339ff from marlins configuration.h:<br />
<pre class="bbcode">
#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS.
#define max_software_endstops true  // If true, axis won't move to coordinates greater than the defined lengths below.</pre>
<br />
Another point, maybe Marlin resets the code-buffer after homing?<br />
<br />
-Olaf]]></description>
            <dc:creator>o_lampe</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 10:35:27 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522664#msg-522664</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522664#msg-522664</link>
            <description><![CDATA[ @wes1007 : I forgot to mention my personal commands. M3 active/ M5 deactive a tool which draws and M12 activate/ M13 deactivate an other tool which determine when we reach the platform. This tool is attached to the Z motor and drive it towards the platform. Unfortunatelly, the tool moves the motors but for the firmware, the motor doesn't move so it still at the position Z0.<br />
<br />
@mandrav : The reason why I don't use this command is because for the software, the motor stay at the same position, Z0 so G0 Z0 won't bring back to the top the motor.<br />
<br />
The first option I thought is to write a custom command which do a similar thing as G28. I want the Z motor move to the top until it hits a endstop. That's why I use the home command but it is not really appropriate.]]></description>
            <dc:creator>Sodombar</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 09:35:50 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522652#msg-522652</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522652#msg-522652</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Sodombar</strong><br />
For bring back on top the Z motor, I use the command G28 Z0 to home it because I don't have enought skill to write my own command to do something like that.</div></blockquote>
<br />
I don't know about the multiple homing issue you describe but the idea is that you home once at the start of the program and from that point on the machine knows exactly where it is (and can move around as instructed).<br />
<br />
Instead of homing multiple times (you have to home it once at the start of the program though), try the following to make the head go back to z=0:<br />
<pre class="bbcode">
G0 Z0
</pre>]]></description>
            <dc:creator>mandrav</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 09:13:58 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522649#msg-522649</guid>
            <title>Re: Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522649#msg-522649</link>
            <description><![CDATA[ I dont see why you need to home it so often? after you have homed it once it should be fine. <br />
<br />
You can instruct the printer to go back to the same position it was homed to by giving it the command G0 Z0<br />
<br />
What does M3 M5 M12 and M13 control?]]></description>
            <dc:creator>wes1007</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 09:12:28 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?146,522641,522641#msg-522641</guid>
            <title>Marlin successive home issue</title>
            <link>https://reprap.org/forum/read.php?146,522641,522641#msg-522641</link>
            <description><![CDATA[ Aye all,<br />
<br />
I'm new here. I work on a 3D printer (based on ramps 1.4 + Marlin) which prints drawings. So it's more like a pseudo-3D printer because drawing doesn't have thickness. <br />
<br />
For bring back on top the Z motor, I use the command G28 Z0 to home it because I don't have enought skill to write my own command to do something like that.<br />
<br />
My issue is between two calls of G28, sometimes the gcode inside is not executed. The Gcode is well executed untill we reach these lines :<br />
<br />
G28 Z0<br />
G0 X-9.253807106598984 Y26.3502538071066<br />
M12<br />
M3<br />
G1 X-0.5939086294416244 Y21.3502538071066 F250<br />
G1 X-0.5939086294416244 Y11.350253807106599<br />
G1 X-9.253807106598984 Y6.3502538071066<br />
G1 X-17.913705583756347 Y11.350253807106599<br />
G1 X-17.913705583756347 Y21.3502538071066<br />
G1 X-9.253807106598984 Y26.3502538071066<br />
M5<br />
M13<br />
G28 Z0<br />
G0 X-7.894670050761421 Y-6.361167512690355<br />
M12<br />
M3<br />
G1 X0.766497461928934 Y-11.360406091370558 F250<br />
G1 X0.766497461928934 Y-21.360406091370557<br />
G1 X-7.895939086294417 Y-26.360406091370557<br />
G1 X-16.555837563451774 Y-21.360406091370557<br />
G1 X-16.555837563451774 Y-11.360406091370558<br />
G1 X-7.895939086294417 Y-6.3604060913705585<br />
M5<br />
M13<br />
G28 Z0<br />
<br />
<br />
There is approximately 10 lines between two calls. These lines are not executed. They are just ignored so we have a succession of home command. <br />
<br />
I noticed that the Gcode is well exectued when there is enought command between two calls (around 20 lines).<br />
<br />
When there is enought command line between two calls, it works well again. It appears that there is a kind of delay between two calls.<br />
<br />
If I have a question, it would be : is it a mistake to use the home command so many times ?<br />
<br />
PS : sorry for my approximate english ^^"]]></description>
            <dc:creator>Sodombar</dc:creator>
            <category>Firmware - mainstream and related support</category>
            <pubDate>Wed, 17 Jun 2015 08:56:28 -0400</pubDate>
        </item>
    </channel>
</rss>
