Could do with knowing what control board you are using.
I would look into small isolator modules to control your M3/M4.
If you are using one of those 5 axis boards and the on-board relay, I had trouble with it.
If you have outputs (from Mach input output pages) configured to m3/m4 AND have spindle dir assigned in motor pages, the 2 will conflict.
Dir should be 0. Outputs#1-6 in Mach pages configured to bob pin, those outputs configured to m3/m4.