What the cause might be?
Noise? Do you have very long wires to the photo-interrupter?
Please post a schematic
Does it make any difference whether the motor is actually connected? I mean, if you connect it's power supply to the driver board/shield and switch it on in software, but don't connect the cables to the motor itself.