Hi,
I am using a B-G431B-ESC1 together with the Arduino Simple FOC 2.2. running a test example with 6PWM velocity_openloop, built using Platformio.
TIM1_CH2N is not generating any PWM signal and motor is not mowing correctly, if at all.
The PA12 (pin 34) is constantly held HIGH by some reasons.
It is the same using a simple Blink program for PA12 and PA9 with the B_G431B-ESC1 board. PA9 toggles as expected
main.c
#include <Arduino.h>
void setup()
{
pinMode(PA9, OUTPUT);
pinMode(PA12, OUTPUT);
}
void loop()
{
delay(20);
digitalWrite(PA12, LOW);
digitalWrite(PA9, LOW);
delay(20);
digitalWrite(PA12, HIGH);
digitalWrite(PA9, HIGH);
}```
When switching to another STMG431 board using platformio.ini both PA12 and PA9 toggles as they should!! Strange and to deep in the STM32 for my knowledge.
Note that I am still using the B-G431B-ESC1 board for debugging.
Only change the build target def.
platform.ini
It sounds like you know what you are doing. Based on your description, and especially your second test, I really only see an error in the board setup files as the explanation.
You could check programmatically by seeing if digitalPinToBitMask(PA12) and digitalPinToPort(PA12) gives the values expected for port and pin numbers.
Do I understand correctly that if you switch the board from board = disco_b_g431b_esc1
to board = nucleo_g431rb
Hi,
thank you for your reply. I will try your suggestions.
Yes that is correct, PA12 starts to work.
I will also try to get SimpleFoc working with the board = Nucleo_g431 initially and then manually configure it to be disco_b_g431.
I have tried several differnt B-G431-ESC1 board so no problem with the hardware itself
Hi Anders, did you find a solution for this? I seem to face exactly the same problem and wasted two days on it now. Just found out what you observed above.
Hi, I spent some time figuring out that all low level registers where correct from the SimpleFoc way of config, but still no luck. Then some day ago I saw this topic which seems to found the problem. Sounds correct, havent tested yet.