Alignment issues

Is this a new machine? If so, check everything mechanical first. Make sure everything is tight, including (especially) set screws holding the belt pinions in place. If those slip a little every time you change direction, it wreaks all kinds of havoc.

After checking everything mechanically, the next thing I would check is the motor pulse polarity:

Don’t assume it’s software or configuration until you’ve eliminated everything else. If the settings were actually correct when it arrived and you change a bunch of them, it’ll be hell to figure it out later.