Weird Behavior After Completed Job

Home Forums TinyG TinyG Support Weird Behavior After Completed Job

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #12161
    S221B
    Member

    So, here’s a puzzler:

    The last two jobs I’ve run on my TinyG-equipped CNC have gone as follows:

    1) power up machine and connect
    2) Do a G28.2 X0 Y0 Z0 homing cycle, which completes normally
    3) Position the tool using jog
    4) Re-zero machine to workpiece with G92 X0 Y0 Z0
    5) Job runs successfully (20-30 minutes of run time)
    6) After job has completed, run another G20.2 X0 Y0 Z0 to put it back in the parked position…

    And here, at step six, the Z-axis homes, bumps the switch, and retracts; then the X-axis moves…and stops short of the switch? The Y-axis doesn’t move at all, it’s as if the machine thinks it has finished it’s homing cycle.

    It’s bizarre. No error code is thrown, and there’s no sign that the board is trying to move the motor, because the lights on the motor driver aren’t blinking, and the position indicator on my G-code sender doesn’t show any motion.

    If I run G28.2 X0 Y0 Z0 again, it will home normally.

    I don’t think it’s a motor connection issue, because jobs run fine, and (after a second request) the machine does home normally. I don’t think it’s a limit-switch issue, because (after previous problems with limit switches) I wired everything with grounded shielded cable, lab-grade banana plug connectors, and run normally-closed for all the switches, and this only shows up when homing after job.

    I’m baffled. Any theories?

    #12162
    cmcgrath5035
    Moderator

    Please clarify what command you are entering at Step 6, I am not familiar with a G20.2 ? Perhaps that is a typo?

    Also, confirm that you have you limit switch on Z at the top of travel, presumably near the mechanical top of travel . I think of most questions in the context of a 3 axis gantry machine, you might have something very different.

    And describe your jog in step 3, do you jog the Z axis? If so, seems Step 4 would change Z0 to a setting not at the mechanical Z0 which could explaining step 6 hitting the mechanical Z0 switch.

    #12163
    cmcgrath5035
    Moderator

    a resend to make sure I get notified of a response

    #12164
    S221B
    Member

    To clarify and address your questions:

    1) It was a typo in my original description of step six; the homing is done with the usual command G28.2, not G20.2 as I had originally typed.

    2) I do indeed have a limit switch at the top of Z travel, which is triggered normally when homing the Z axis. The machine is, indeed, a three-axis gantry type machine, with X+ moving away from the operator, Y+ moving to the left, and Z+ moving upward. (A conventional “right-handed” coordinate system.)

    3) When jogging in step 3, I do move the Z-axis downward to a negative absolute coordinate location. When I then use G92, it sets offsets to make the new location (with the tool now located relative to the blank) 0/0/0 in the working coordinate system. (I believed that this was normal practice.)

    To clarify the problem – in step six, when I go to home the machine after completion of a job with G28.2, the Z-axis travelling upward, bumping the switch, and the retracting is normal (not a problem) for homing. The odd behavior is that the X-axis, which then *starts* to move toward its home position, stops moving before it actually contacts the switch, and then the Y-axis (which would typically home last, after X) doesn’t move at all.

    No error shows up when X stops moving. Re-issuing the G28.2 command after this “incomplete homing” then results in normal behavior; the Z-axis moves/bumps/retracts, followed by X, then followed by Y.

    It’s like something is stopping the normal homing routine, but only in this specific condition, and the absence of an error code is baffling.

    #12165
    cmcgrath5035
    Moderator

    OK, the original step 6 typo comment confirms what I suspected and makes sense.

    And I’ll paraphrase that your job is programmed to return the machine to Machine zero, not the offset zero established by step 4. You could have asked why you needed to issue the rehome twice.

    I need to add that this is the only discussion I have ever been involved in where a Zmax switch was actually implemented by the user. So , while unlikely, we may be dealing with a 5YO (probably more) that has never been seen.

    I’ll bypass most of my usual questions about the set up and parameter setting. You are running FW 440.20, I assume?

    A couple of possibly helpful debug questions
    A. After the job runs (Original step 5), where does the machine think it is in offset x,y,z space? Is that location what your programming expects?
    B. Does a $$ parameter dump reveal anything odd when run at this point?
    C. After checking location, try manually jogging up to a safe Z height, then issuing just a G28.2 X0 Y0

    #12166
    S221B
    Member

    I will follow up on your questions A, B, and C tonight if I can get out to the shop.

    Regarding your statement that having a Z-max switch and homing to Z-max is unusual – I guess I am just surprised by this. I suppose that most users must therefore home to Z-min. I never thought about this too much (I have switches on both Z-min and Z-max), and I home to Z-max because then I never have to worry about crashing a long tool into the table while homing, and it gets the spindle up out of the way for attaching/removing a workpiece.

    Another theory (which I will test) from a co-worker is that the M30 command at the end of my G-code file is “getting stuck”, and that the machine is actually pausing at the end of the file rather than completing. I can imagine that running a G28.2 in this condition (which the machine regards as the “paused middle” of an incomplete G-code file) might cause screwy behavior. I will test this more thoroughly.

    Thanks for all of your input so far – as problems go, this isn’t too bad, as I am still able to run and complete jobs – but as an engineer, I hate unsolved mysteries and ghosts in the machine.

    Cheers!

    #12167
    cmcgrath5035
    Moderator

    tinyG was born perhaps 8 years (or more) ago and focused on the DIY build your own 3 axis machine, which morphed quickly to 4 motor three axis machines. Many basic kits came out with no limit switches at all, then larger, more rugged designs came along as well. Any tinyG was used in many 3rd party machines.

    Make sure you read this wiki item carefully
    https://github.com/synthetos/TinyG/wiki/Homing-and-Limits-Description-and-Operation

    Summary: G28.2 is hard coded to home to Zmax if it is enabled. It will not home to Zmin. If Z homing is used, Z home must be Y=0 and all z motion down must be negative. these are the assumptions used in tinyG.
    G2core has implemented some flexibility. I believe (I am not a developer) the decision was made to minimize Z homing that dragged across the work piece.
    ALso read theru https://github.com/synthetos/TinyG/wiki/Gcode-Support, see if your interpretation of G30 is same as Synthetos.

    The Zmin switch, or Zmin input, is also used for automatic probing of the work piece.

    Good luck with sorting this out, as you say it may just need a procedural workaround.

    #12168
    S221B
    Member

    Everything you just said makes perfect sense to me. I think we might have been “talking past each other” with how we were describing Z-min and Z-max and the correct homing routine, but I am 100% aligned with “home Z to zero, all Z motion downward is negative”.

    I’m becoming increasingly convinced that the error might be that my G-code, which executes all of the moves (finishes cutting the part successfully), is actually getting stuck in the final couple lines at or around the M30 command, and this is what’s causing the quirks.

    I will update this post after bug-checking so that other users may reference this if they encounter the same thing. Thanks again for all of your help!

    #12169
    cmcgrath5035
    Moderator

    Just a thought – I see that M30 resets to $gun default setting, G20 or G21

    Any chance your job runs in the “not default” measurement system?

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.