Nucleo-F411RE can not run SimpleFOC-Shield2.0.1

Hi everybody,

i got a SimpleFOC-Shield2.0.1 and was using it with an Arduino UNO with the AMT103 encoder. It all went great till i had to exchange the arduino with a Nucleo-F411RE, because of the low memory of the Arduino UNO. Now with the Nucleo the motor dosnt work anymore. I have checked the encoder with the test script that SimpleFOC is providing and it works the way it should. When i try to run the motor it doesnt move at all or is just moveing back and forth. I tried different pwm configurations, cause i have seen that nucleo boards sometimes have to switch pwm C phase between pin 11 and 13. I tried both but it didnt work, also the stm32CubeIDE is telling that the i should use pin 13 cause pin 11 and 9 are using the same pwm channel.

I tried running the polepair finding example and only changed the pwm pins in the code to be:
( BLDCDriver3PWM driver = BLDCDriver3PWM(PC7, PB3, PA5, PA8); )
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 3, 13, 7);
Encoder encoder = Encoder(12, 2, 500);

In another post it was suggested to use the same timer for the pwm but non of the possible options for the solderpads of the FOC-Shield can meet that requirement. So im confused as to what configuration would run my motor.

I hope its enough information to help solve the issue.

Thanks.

Hey @Stefan,

I’ve been using the Nucleo F411RE, and it works really great :smiley:
I am not sure what is the problem exactly in your case though.

I am using the Arduino pin names (not suing the PAx,PBx and PCx) but this should not change much. Dos your driver work in open loop?
Of it doesn’t you wont be able to use the example which calculates the pole pairs number

This is important for some boards, especially for 6PWM mode but for f411re this should not be an issue.

In my case I’m using pin 13, pin 11 does not work for me.
Im using these pinouts:

  • Sheld1 : 5,10,6,8
  • Shield2 : 3,9,13, 7

This is the combination I’ve used recently in the balancer video, and in that video I’ve used ESP32 D1 R32 board and Nucleo F411RE :smiley: https://youtu.be/f9GJqqUpL2w?t=194

Hey @Antun_Skuric,

thanks for the reply.

I have tried both of the pin setups you mentioned but non of them seem to work for me. The motor is just moveing back and forth as if one of the phases is blocking the motor from turning.

Im also confused why you are using the pwm pins in that order, cause on the shield it says that phase A uses pin 10 and B ist 5, but you are switching them in your code. I have also tried to switch them, but it doesnt solve problem.

I also used the same code with my arduino uno to check if i damaged the shield, but its all working with the arduino.
Is there something i need to enable on my nucleo or some other thing i havent thought of?

Hey @Stefan,

The order of the pins is not a big problem since the code will automatically adapt it.

Did you try to run it in open loop?
Do you have the linear regulator enabled?

You should not need to do anything other than upload the code.
Which stm32 support package are you using? Is it stm32duino?

Hey @Antun_Skuric,

I just ran it in openloop and it worked. I assumed that the pp check script would work if the openloop works.

I do not use the regulator. The nucleo is powered by the usb kable.

And for some reason it is working all of a sudden and i have no clue why.
After i checked if the openloop was working, i was wondering why the closedloop would not work (cause the encoder was working individualy and the motor as well) and checked the closeloop script again. Then it just worked.

I dont know what i changed or what is different now, but im happy its working now ^^

Thanks for your help :slight_smile:

1 Like