Hi I am interested about generate 3 pwm send to simplefocmini without Arduino ide I want make by stm32cubeide .
In ArduinoIDE I can drive motor gimbal velocity mode done
But I will try by stm32cubeide then have not idea from little knowledge Usually we generate a signal through TIM But the signal I generate is not the same.Arduino ide (I don’t have a sample?Libraries )
I want to know how to generate a signal like?
In the future I will have to apply to stm32h750 So I came here to find out. prepared for use
It’s an arduino library so you need to use something compatible with arduino libraries.
Most of the users here use VSCode with Platformio plugin, which allows you to use the stmduino core so that you can use Arduino libraries on STM32 microcontrollers. It’s not possible to use directly in STM32IDE without modifying the library to work natively on STM32.
Yes, you are not going to get a huge amount of help if you use stm32cubeide as this library is not compatible. Going the platformio route will mean you can use the simplefoc library. The hal libraries are available from platformio so you don’t lose all the stm32 goodness.
If you really want to persevere with stm32cubeide, it will be reasonably straightforward to get the motor spinning (just need to do pwm sine with 120 desgrees apart for each phase) + a few driver enable/sleep considerations - but things get much harder after that (foc/closed loop/sensors) and you might melt the bought if you don’t implement your own voltage limits.
It will create most of the code for you, leaving it to you only to make specific changes.
Having said that, though, I’m not sure that avoiding Arduino buys you anything. And I say this as someone who has coded extensively with stm32cubeide and Platformio with the Arduino framework. And I have used the Motor Control SDK a bit (and found it to be much harder to modify than SimpleFOC), good luck adding an SPI encoder to the STM32 MC, for example.
With Platformio, you have a more modern and streamlined IDE (stm32cubeide is built on top of Eclipse with many changes), full code management and identical ability to debug in real time. The old Arduino IDE is not a real development environment, and way too limited, but Platformio is a different beast altogether.
So, what’s the real reason to avoid Arduino? The STM32H750 is supported by the STM32duino framework (which, incidentally, it’s developed and fully supported by STM). Yes, the STM32duino framework is over-reliant on the HAL, and that is bloated, slow and hard to follow, but when needed you can easily access the LL libraries and write very efficient code (as efficient as the stm32cubeide can be). I use a mix, relying on the stm32duino and the HAL for the high level configuration and things like USB, but use LL or even direct register access for the time-critical code. All from Platformio
It’s pretty easy to use for the default cases if you have the hw they support (like the G431B ESC). Changing things, on the other hand, it’s hard. They support HALL and ABZ encoders, nothing else at the moment. To add support for, say, an SPI encoder, one needs to change a lot of code in many files, none documented.
Hairball is an apt description of a lot of the things STM does, including the HALL. And the STM MC is built on top of the HAL. Trying to follow the code is a nightmare.
That’s why I’m not really recommending it over SimpleFOC