Reset SimpleFOCStudio?

My installation of SimpleFOCStudio is having problems. Some functions work, others do not. Right now it is not receiving telemetry from the ESP32. This set of data repeats and does not change. The “Pull parameters” does work.

’’

It could be my code too. That last field I believe is the data from the AS5600 sensor. It seems quite random upon reset of the ESP32 but once the data stream starts, the values never change. It USED to work and the “Angle” display would track the motor sensor but I have been unable to get it to work again.

Here is the current code:

**
 * ESP32 position motion control example with magnetic sensor
 */
#include <SimpleFOC.h>

MagneticSensorI2C sensor = MagneticSensorI2C(AS5600_I2C);

// Motor instance
BLDCMotor motor = BLDCMotor(11);
// define BLDC driver
BLDCDriver3PWM driver = BLDCDriver3PWM(16,17,18,19);


// angle set point variable
// float target_angle = 0;

Commander command = Commander(Serial);
void doMotor(char* cmd) { command.motor(&motor, cmd); }

void setup() {
  
  Serial.begin(115200);
  Wire.setClock(400000);
  // initialise magnetic sensor hardware
  sensor.init();
  // link the motor to the sensor
  motor.linkSensor(&sensor);

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

  // choose FOC modulation (optional)
  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;

  // set motion control loop to be used
  motor.controller = MotionControlType::angle;

  // maximal voltage to be set to the motor
  //motor.voltage_limit = 4;

  // angle P controller
  //motor.P_angle.P = 20;
  // maximal velocity of the position control
  //motor.velocity_limit = 20;

  // The letter (here 'M') you will provide to the SimpleFOCStudio
  command.add('M',doMotor,"motor");
  // comment out if not needed
  motor.useMonitoring(Serial);


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



  Serial.println(F("Motor ready."));
  _delay(1000);
}

void loop() {
  motor.loopFOC();
  motor.monitor();
  command.run();
}
// all looks good 24 dec at 11 am...loaded onto board

Hey, that’s strange! I can’t immediately see anything wrong with your code…

Does the monitoring work in the normal Serial console? Is it a problem of the ESP32 or of the SimpleFOC studio side?

Runger; I suspect the ESP32 side. Using the serial monitor on the Arduino IDE…I see the same static data scrolling by 0.0000 0.0000 0.0000 -76543.3281 and it does not change when the motor (AS5600) is moved.

this program correctly reports both AS5600’s in the IDE serial monitor.

#include <SimpleFOC.h>

MagneticSensorI2C sensor0 = MagneticSensorI2C(AS5600_I2C);
MagneticSensorI2C sensor1 = MagneticSensorI2C(AS5600_I2C);

void setup() {
  Serial.begin(115200);
  Wire.setClock(400000);
  Wire1.setClock(400000);
  Wire1.begin(33, 32, (uint32_t)400000); //Keshka put sda on pin 33 and scl on 32 for second sensor
  sensor0.init();
  sensor1.init(&Wire1);
}

void loop() {
  sensor0.update();
  sensor1.update();
  Serial.print(sensor0.getAngle()); 
  Serial.print(" | "); 
  Serial.print(sensor1.getAngle());
  Serial.println();
}

huh, looking at your code with a more fresh mind this morning, I see now the main loop is missing the call to motor.move().
Does it help if you add this call?

Runger; I had left it out thinking FOC studio could send movement commands via the “Jog” button. I have not figured out just what the “jog” button does yet. This morning it is greyed out and does nothing. (edit) kk, figured that out. It sends a target command.