Skip to content

Conversation

@StryderUK
Copy link
Contributor

I aplogise if this method of doing a pull request is incorrect as this is my first ever one.

Summary

No motor movement when using SimpleFOC and running simple example (below) on B_G431B_ESC1 discovery board. When seting up board using 1.9.0 and @owennewo files (information here) this example was working fine. Found PA_10 has not been uncommented to allow a timer to be attached.

// Open loop motor control example
#include <SimpleFOC.h>

// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(3);

BLDCDriver6PWM driver = BLDCDriver6PWM(A_PHASE_UH, A_PHASE_UL, A_PHASE_VH, A_PHASE_VL, A_PHASE_WH, A_PHASE_WL);

void setup() {

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 24;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // limiting motor movements
  motor.voltage_limit = 10;   // [V]
  motor.velocity_limit = 5; // [rad/s] cca 50rpm
 
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

  // init motor hardware
  motor.init();

  _delay(1000);
}

void loop() {

  // open loop velocity movement
  // using motor.voltage_limit and motor.velocity_limit
  motor.move(analogRead(A_POTENTIOMETER));
}

Validation

  • Sketch above has been tested and now workng with uncommented line

@owennewo
Copy link
Contributor

I can't merge but agree this PR looks sensible. There should be 6 timer pins defined for this board to allow a motor to be controlled.

@fpistm fpistm added the fix 🩹 Bug fix label Jun 21, 2021
@fpistm fpistm added this to the 2.x.x milestone Jun 21, 2021
@fpistm fpistm self-requested a review June 21, 2021 06:41
@fpistm fpistm merged commit 70bd40f into stm32duino:master Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 🩹 Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants