It kinda works,
I can send a value over serial to the Due and the motor moves back and forth according to the received data. Motor direction depends on the new value being greater or smaller than the actual encoder-register.
Next step is to use the step-pulses from Duets external stepper port to make it run in sync (speed control) and use the dir pin as well.
@wifibeagle that can easily be incorporated though as endstops can be changed to triggers at the beginning of a job.
Or you can permanently have them set up as triggers and change them to endstops at the start of the homing sequence and then put them back as triggers