Stack Overflow and Movement Error after Resuming Job

  • Hi, I'm testing the pause and resume functions while performing a drawings task on my CNC machine. I'm drawings a simple circle that is 140mm in diameter. I'm running my machine at 2000mm/min with an acceleration of 100mm/sec - so it's moving quite fast.

    When I pause the job, either on screen on using an external trigger the following is performed:

    G60 R0 ; Store last location
    G91 ; Relative positioning
    G1 Z20 F500 ; Slowly move z axis to safe location clearing material
    G90 ; Absolute positioning
    M5 ; Turn off Spindle
    M117 Turning off and raising spindle ;
    G4 p1000 ; Dwell while spindle slows to stop
    G53 G1 F1000 Z-1 ; move z axis to safe z

    The resume file is a little mores simple and looks as followed:

    G1 F1000 R1 X0 Y0 ; Move directly above position of last move
    M24 ; resume print

    But I get the following errors and the vector veers off as illustrated in the photo I've attached:

    Error: M24: Cannot print, because no file is selected!
    Error: Push(): stack overflow


    This is pretty concerning because if I were performing a CNC task and I was at the bottom of my cut, a sideways movement could break the tool, unseat the material, and even push the squareness of the z axis off.

    Does anyone have any idea why this happens - and how this might be prevented from happening again?

  • Hiya I've work out what the problem was.

    I exported the gcode file from my CAM software to use G2 or G3 arch movements. The current firmware doesn't cope well with these type of interpolated movements. I'm using basic G Code (mm) post processor now but there probably needs to be a dedicated one for the Duet.

  • administrators

    I am sorry for the delay in responding. RRF should have no problem with G2 or G3 movements. If you have particular issues with how G2/G3 are executed, please provide details. Also let us know which firmware version you are using.

    Stack overflow is usually caused by accidentally creating a recursive macro. In this case, the reason is that you included M24 in the resume.g file, and M24 calls resume.g. Remove the M24 command from resume.g.

  • @dc42 Hiya - I'm using Firmware V2.04. I took the G60 command from the pause.g file and the M24 command out from the resume.g file but what I found was the external trigger I had created which used a M98 command to reference the resume.g file didn't work. I could resume the pause from the web interface, but not the external trigger file. That said I was still getting the same problem with veering movement. I tried different shapes and it didn't have the same problem but what I noticed was the pause on a square would be delayed until the line of g-code was completed. With a circle, the pause was pretty instant but the resume resulted in the x and y axes veering off and joining back to the start of the next line of g-code. It was as if it couldn't recalculate the interpolation from the saved point.

    This is what the G-code exported from Vectrics Aspire:


    Cheers, Savvas

  • administrators

    @educatingsavvas said in Stack Overflow and Movement Error after Resuming Job:

    I took the G60 command from the pause.g file and the M24 command out from the resume.g file but what I found was the external trigger I had created which used a M98 command to reference the resume.g file didn't work.

    All you need to put in the trigger file is M24.

    The GCode you list looks ok for RRF except for the S0M3 line.

  • @dc42 Yes that's what I did in the end. Placing M24 in the trigger file but in any case if I export from my CAM software to a G-code post processor that uses arch interpolation the resume doesn't work as expected. If I export the g-code with a post processor that breaks the arch into lots of smaller individual lines the resume continues from the correct pause location.

    G2 and G3 do work, providing you don't pause and resume during that piece of g-code.

  • administrators

    Thanks, I'll test pause/resume in the middle of G2/G3 moves.

  • @dc42 Hiya - just following up. Did you manage to get time to test the pause and resume functions with interpolated g-code? Cheers, Savvas

  • @dc42 Hi I'm just following up this issue with something that I noticed since updating to RRF3.01 RC5.

    When I resume a job with an M24 command in an external trigger (T2) while running arc interpolated g-code, the spindle move to the last saved location and then veers off unusually as illustrated with the drawings in a previous post - at a right angle. I tried placing a M300 command to play a sound during trigger2 and noticed it would beep twice. If I use the on screen resume button and remove the M24 command form the external trigger this veering movement behaviour doesn't occur. Thought it was worth mentioning.

    Relevant code in my config.g file:
    M950 J6 C"!^exp.e2stop" ; Allocate GPIO Port 6 to pin 4
    M581 P6 T1 C0 ; Pause - PIN4
    M950 J7 C"!^exp.e3stop" ; Allocate GPIO Port 7 to pin 9
    M581 P7 "e3stop" T2 C0 ; Trigger2.g - PIN9

    In trigger2.g file:
    M300 S300 P1000 ; Play sound
    M24 ; Resume

    My resume.g file:
    M3 R0 ; Turn on PWM
    M42 P0 S1 ; Turn on spindle enable
    G4 P4000 ; Dwell
    M291 P"STAND CLEAR! Job Resuming." R"Warning" S2 ; Display message and wait prompt

Log in to reply