MOT: init FOC Failed

Hi, I’m trying to run the BLDC motor using simpleFOCSheied and Arduino Mega. When I combined and operated simpleFOCSheied with Arduino Uno, the motor turned, but when I connected to Mega and operated it, it did not work with the following results.

MOT: Monitor enabled!
MOT: Init
MOT: Enable driver.
MOT: Align sensor.
MOT: Failed to notice movement
MOT: Init FOC failed.
Motor ready.

So I don’t think it’s an Arduino code issue and it seems to be a hardware connection issue. The BLDC motor I am using is EC 45 flat. The only difference from the code I used when connecting to Uno is that I changed the pin number of the 3PWM and encoder.

BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11,8);
Encoder encoder = Encoder(18, 19, 2048);

I used pins like this. I connected the common ground and the power source. What’s the problem?

Hey, welcome @sdkancknxld ,

The PWM pins used look ok, I am not sure about the encoder. Are 18 and 19 interrupt-capable pins on the Mega?

The output you show means the initialisation cannot detect the motor movement - was the motor in fact moving?
If yes, then this is very likely a sensor problem.