Hi everyone. I am experiencing something strange. I moved testing my ifx007i board to Nucleo 144 due to some issues I hit with the Mega, which I’ll describe later. The board is F767ZI. This is the setup:
Using Arduino IDE. The Nucleo board runs fine, I can output on any pin, I tried with simple code. Outputs both PWM, digital, input analog, nothing out of the ordinary.
However when I build the SimpleFOC, after loading the build, the board goes mute, absolutely no response on any pin. Just to make sure, I embedded a bit of debug code to output on a pin not used by the ifx007i board, no result. I tested with the oscilloscope on all pins in case I mis-directed pins, nothing. I tried calling the pins with the Arduino names instead of addressing directly, same nothing. I am rather stumped. If you have experienced something similar, please help. Can’t think of anything at that point. I must be doing something really stupid but can’t catch it.
Below is the code.
// Open loop motor control example
#include <SimpleFOC.h>
// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(7);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(D9, D10, D11, D3, D5, D6);
//target variable
float target_velocity = 10;
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
void setup() {
// driver config
// power supply voltage [V]
driver.voltage_power_supply = 12;
//driver.pwm_frequency = 30000;
driver.init();
// link the motor and the driver
motor.linkDriver(&driver);
// limiting motor movements
motor.voltage_limit = 2; // [V]
motor.velocity_limit = 100; // [rad/s] cca 50rpm
// open loop control config
motor.controller = MotionControlType::velocity_openloop;
// init motor hardware
motor.init();
// add target command T
command.add('T', doTarget, "target velocity");
Serial.begin(115200);
Serial.println("Motor ready!");
Serial.println("Set target velocity [rad/s]. Example: T10 will set the target to 10 [Rad/s], T-10 will run in reverse.");
_delay(1000);
pinMode(D0,OUTPUT); // debug code to test Nucleo 144 / F767ZI
}
void loop() {
digitalWrite(D0,HIGH); delay(1); // debug code to test Nucleo 144 / F767ZI
digitalWrite(D0,LOW); delay(1); // debug code to test Nucleo 144 / F767ZI
// open loop velocity movement
// using motor.voltage_limit and motor.velocity_limit
motor.move(target_velocity);
// user communication
command.run();
}