I am not familiar with that machine, but generally there is pulse generator or encoder on the motor shaft back to the drive for speed control and also one on the final spindle shaft, this is to synchronize the Z axis etc.
As a rule, the encoder on the spindle does not cause a spindle alarm.
If it is a spindle alarm, then I would suspect the device on the motor first.
Generally drive manuf. do not make encoders but use other suppliers for these.
Heidenhain are one of the largest, especially if a European made in machine.
Al.