@robinfaurecia Check the voltage levels on the output.
Most external drivers (including the DM542T) require at least a 5v step/dir signal, while the duet will put out 3.3v by default. This works on some 5v systems but is not guaranteed and can lead to inconsistent behavior.
If you're not already using it, this product breaks out the expansion motor signals to 5v differential outputs which can help with external driver compatibility.
Beyond working on the signal itself, could you reduce the microstepping to the motor? At x32 microstepping with a 3mm lead screw that is a Z resolution of 0.0005 mm which may be finer than needed for your application.
Reducing it even to x8 would still leave you with a Z resolution of ~0.002mm and cut the steps by a factor of 4.
Of course this depends on what you actually need out of the Z.