Pause.g and Resume.g with VFD Router Spindle.



  • Hi - I am using a VFD powered router spindle on my CNC machine.

    To get it working in the config file I have enabled CNC mode with the M453 command, and disable heater 1 to use for the PWM with a M307 H2 A-1 C-1 D-1 command. I also disabled extruder heater 0 and in used a M42 P1 S1 command in the post processor to enable the spindle.

    To turn my spindle on I have to write two macros M3; M42 P1 S1; and to turn it off M5; M42 P1 S0;

    It all seems to be working providing I use the custom post processor apart from pausing and resuming.

    The job spindle speed is not saved during a job pause, so after resuming it doesn't turn until the next segment in the code where the M3S# code appears. I can add an arbitrary M3S# command in the resume file but this will not reflect original speed - which may be material specific such as slower for plastics or faster for MDF.


  • administrators

    @EducatingSavvas said in Pause.g and Resume.g with VFD Router Spindle.:

    To turn my spindle on I have to write two macros M3; M42 P1 S1; and to turn it off M5; M42 P1 S0;

    Why do you need to do that? RRF understands M3 and M5 when in CNC mode.



  • @dc42 My VFD needs a M3[S] command otherwise it won't know what speed to turn.

    My frequency drive needs a spindle enable signal to turn the spindle on, and a PWM to set the RPM. Two signals to control the frequency drive.

    At the moment if I pause a job the tool completes it's line of g-code, then raises and turns off the spindle. If I resume the without writing a specific m3[S] in the resume.g file the job just plunged back into the cut, moves along the line of g-code until a new segment where the M3[S] command turns it back on.

    If I had material there it would have either broken the bit or pulled the material off the wasteboard.


  • administrators

    @EducatingSavvas said in Pause.g and Resume.g with VFD Router Spindle.:

    My frequency drive needs a spindle enable signal to turn the spindle on, and a PWM to set the RPM. Two signals to control the frequency drive.

    OK, I see the problem now.

    Can you use M3 to set the PWM, and another command to turn the spindle on/off? RRF saves the M3 spindle speed when you pause, and it can be restored using M3 R1.



  • @dc42 Sorry for the late reply - I only just had a chance to test this. I'm still using RRF 2.03 and it didn't work. Is this a feature in RRF3?

    My Pause.g file look like:

    G91 ; Relative positioning
    G1 Z5 F500 ; Slowly move z axis to safe location clearing material
    G90 ; Absolute positioning
    M5 ; Turn off spindle PWM
    M42 P1 S0 ; Turn off spindle enable
    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

    and Resume.g like:

    M3 R1 ; Turn on spindle PWM
    M42 P1 S1 ; Turn on spindle enable
    G4 P4000 ; Dwell
    M291 P"STAND CLEAR! Job Resuming." R"Warning" S3

    Thanks again.


  • administrators

    You might need RRF 2.04 to get that functionality.



  • @dc42

    Hi - I just updated the firmware to RRF2.04 but still no luck.

    I tried adding M5 G60 R1 to the pause.g file and and M3 R1 but this doesn't seem to send the PWM command to the frequency drive. I even tried putting a M42 P2 R1 command in to see if that works, but that didn't either.


  • administrators

    @EducatingSavvas said in Pause.g and Resume.g with VFD Router Spindle.:

    @dc42

    Hi - I just updated the firmware to RRF2.04 but still no luck.

    I tried adding M5 G60 R1 to the pause.g file and and M3 R1 but this doesn't seem to send the PWM command to the frequency drive. I even tried putting a M42 P2 R1 command in to see if that works, but that didn't either.

    What M453 command are you using in config.g?



  • @dc42

    I changed the M453 command from M453 S0 P2 I0 R24000 F300 T1 to M453 P2 R24000 in the config file but that didn't change anything. The M3 R1 command in the resume.g file still doesn't seem to recall the PWM signal from P2 after being paused. I tried M3 R0 and M3 in pause.g M5 G60 R0 and M5 in resume.g, but again no luck.

    When the job is paused I can see the XYZ coordinates in the console, but I can't see the PWM state.

    I did get it to sort of work by commenting out the M5 command in the pause.g file and using the M42 P2 S0 disable the frequency drive - but I'm not happy with that. If something goes wrong with the third party PWM to analoge convert I'm using between the Duet and frequency drive, the spindle is still receiving the PWM speed during a pause and could turn on.


Log in to reply