roboticsatiowa / Rover_Embedded

1 stars 0 forks source link

Common Anode Stepper Pulse Control #10

Open Naitry opened 1 week ago

Naitry commented 1 week ago

This issue is directly mentioned in the main loop of main.cpp, our core embedded firmware

  // need to update pins manually because we are using an open collecter (common anode) configuration which isnt supported by the hardware pwm timer.
  // see https://www.omc-stepperonline.com/download/DM542T.pdf section 4 for more info on open drain configuration

  // TODO manually updating pins work fine for now but will be severely impacted by any blocking code. need to look into a better solution
  wristInclinationMotor->updatePin();
  wristRotationMotor->updatePin();
  baseMotor->updatePin();
  gripperMotor->updatePin();

The current code repeatedly checks the current period of a stepper motor (time since last flipped) and changes the state dependently. This manual flipping is necessary due to our use of an open collector configuration.

The issue is that this competes with serial input in the main loop and can be blocked by the serial input, preventing it from controlling the motors sometimes.

We need to change the way in which we control the steppers to prevent it being blocked by other processes.