ESP32 S3 Crashing

I’m trying to run SimpleFOC version 2.3.4 using the arduino IDE on an ESP32 S3.

The issue is that my board enters an infinite loop of crashing if I uncomment the line driver.init();

Am I doing something obviously wrong?

I have successfully run SimpleFOC in the past on an ESP32, but I’m having trouble with the S3.

Here’s my minimal example which crashes the S3 processor:

#include <SimpleFOC.h>

BLDCMotor motor = BLDCMotor(1);
BLDCDriver3PWM driver = BLDCDriver3PWM(32,33,25,22);
  

void setup() {
  Serial.begin(115200);
  //driver.init();
}

void loop() {
  Serial.println("Hello world");
  delay(100);
}

Any pointers for where I might be going off the rails or what to look at would be great!

Thank you!

Hi @BarbourSmith

I think you are missing these two lines from your code before you can call driver.init.
driver.voltage_power_supply
driver.voltage_limit

Try using the open loop example in the arduino IDE.

// driver config
// power supply voltage [V]
driver.voltage_power_supply = 12;
// limit the maximal dc voltage the driver can set
// as a protection measure for the low-resistance motors
// this value is fixed on startup
driver.voltage_limit = 6;
if(!driver.init()){
Serial.println(“Driver init failed!”);
return;
}

1 Like

I figured that those lines would be set to some reasonable defaults if I omitted them so I took them out for the minimal example…it still crashes with those in

BUT

You did fix my issue. :heart: :heart: :heart:

I don’t know why I didn’t think of just going back to trying the open loop example earlier. The open loop example works great.

Thank you for the help getting me out of that rut!

Ah interestingly it was my pin selection which was making it crash. I’ll have to dig a little deeper to see why that might be

@BarbourSmith

That’s good that you found the issue. I had suspected that might have also been your issue. ESP32 models have a few pins with restrictions. Specifically those pins belong to internal flash and cannot be used for anything else. You might search something like “ESP 32 S3 pinout” so you can check which pins are off limits.

1 Like