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.