Seeking Help: Motor moving one full rotation during initFOC() and then stopping permanently

I have connected a Maxon EC45 50W Motor + Encoder with a TI DRV8313EVM to control the velocity of the motor. The motor is rotating one full rotation during the initFOC() phase but then stopping permanently and not accepting commands. I have separately run the encoder_test as well as the driver_test and they work as expected. Below is my code

#include <SimpleFOC.h>

// BLDC motor & driver instance
BLDCMotor motor = BLDCMotor(8);
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8, 7, 10);

// encoder instance
Encoder encoder = Encoder(2, 3, 2048, A0);
// channel A and B callbacks
void doA(){encoder.handleA();}
void doB(){encoder.handleB();}

float target_velocity = 0;

// instantiate the commander
Commander command = Commander(Serial);
void onTarget(char* cmd){ command.scalar(&target_velocity, cmd); }

void setup() { 
  pinMode(11, OUTPUT); digitalWrite(11, HIGH);
  pinMode(12, OUTPUT); digitalWrite(12, HIGH);
  // initialize encoder hardware
  encoder.init();
  // hardware interrupt enable
  encoder.enableInterrupts(doA, doB);

  // power supply voltage
  // default 12V
  driver.voltage_power_supply = 24;
  driver.init();
  // link the motor to the driver
  motor.linkDriver(&driver);

  // set control loop type to be used
  motor.controller = MotionControlType::velocity;

  // velocity PI controller parameters
  // default P=0.5 I = 10
  motor.PID_velocity.P = 0.1;
  motor.PID_velocity.I = 1;
  //default voltage_power_supply
  motor.voltage_limit = 24;
  motor.voltage_sensor_align = 4;
  
  // velocity low pass filtering
  // default 5ms - try different values to see what is the best. 
  // the lower the less filtered
  motor.LPF_velocity.Tf = 0.01;
  

  // link the motor to the sensor
  motor.linkSensor(&encoder);

  // initialize motor
  motor.init();
  // align encoder and start FOC
  motor.initFOC();

  // add target command T
  command.add('T', onTarget, "target velocity");

  // monitoring port
  Serial.begin(115200);
  Serial.println("Motor ready.");
  Serial.println("Set the target velocity using serial terminal:");
  _delay(1000);
}

void loop() {
  // iterative foc function 
  motor.loopFOC();

  // iterative function setting and calculating the velocity loop
  // this function can be run at much lower frequency than loopFOC function
  motor.move(target_velocity);

  // user communication
  command.run();
}

Well, I don’t have an answer for you , but it seems to me that simplefoc should be returning error codes or throwing exceptions, but it does neither. So it really is a learning platform in the sense that you get to exercise your deductive powers to figure out the problems. But if you finally lose patience, you might consider modifying the library to log errors or something. I was almost about to do that but then I figured out my encoder was bad