I have decided to try and upgrade to v2.3 since I now want to use Vbus and Temp etc
I have tried using exact same config in v2.2 and also using the provided example for the B_G431_ESC and no luck. Here is the Debug output during startup:
STM32-DRV: ERR: no timer on pin 27
STM32-CS: ERR: Analog pins dont belong to the same ADC!
MOT: Init not possible, driver not initialized
MOT: Align sensor.
MOT: Index search...
After some digging around the new library v2.3 I noticed the defines aren’t working correctly for the board type, the b_g431_mcu.cpp file it is darkened/greyed out which indicates the wrong board is being defined. I can’t find any data on the defines #if defined(ARDUINO_B_G431B_ESC1)
I think it’s trying to compile and use the stm32g4_mcu.cpp and other parts where defines are being used #if defined(STM32G4xx) && !defined(ARDUINO_B_G431B_ESC1)
I can trace back and it’s defiantly being defined as STM32G4xx how do I change it to use ARDUINO_B_G431B_ESC1
I have tried with and without lib_archive = false now without the lib_archive = false I don’t get the:
STM32-DRV: ERR: no timer on pin 27
STM32-CS: ERR: Analog pins dont belong to the same ADC!
I have tried the clean all build environment etc and no luck
Can you share the content of your platformio.ini file?
I have been using the G431B esc, and even if the platformio UI shows the Peripheralpins_B_G431B_ESC1.c file as greyed out, in reality at compile time it uses the correct defines from that file. I edited a few entries and the changes were used at compile time. There seems to be a problem with Platformio or Visual Studio that gets confused by the nested defines in the UI, but works when compiling. The “greyed out” feature of the UI is less than reliable, in my experience using it for a couple of years
EDIT: also, look at a file (your directory).pio\build\disco_b_g431b_esc1\idedata.json, you should see ARDUINO_B_G431B_ESC1 being defined. Then add the below to your code, and see if at runtime the string gets printed. In my case, the code in setup() inside the “#if defined” is not greyed out
I have been using the G431B ESC with 2.3 with no problems. I’m pretty sure that @Matt303 issues are either a configuration problem or a pin definition issue, and not a library problem per se
In my idedata.json there isn’t "ARDUINO_B_G431B_ESC1" it’s being called "ARDUINO_DISCO_B_G431B_ESC1"
Maybe they have renamed the definitions in the latest platformio build/update?
EDIT:
Just updated the STM packages and now I have ARDUINO_B_G431B_ESC1 I will do some testing later after work
My guess is that you are victim of a change in naming conventions and now you have a mix of old and new. It happened to me once with Platformio and the STM32duino project (not SimpleFOC)…
If I were you, I would update everything Platformio-related (libraries, cores, etc), then create a new project and just copy your old main.c over the new project (and any other file you might have added). That way you start from a clean slate, but reuse your code 100%