Skip to main content
N_1
Associate III
December 3, 2019
Solved

STM32G431CB Source code ?

  • December 3, 2019
  • 8 replies
  • 2417 views

Hy there,

I would like to ask you, if there is possible to get the basic source code that you are uploading to the STM32G431CB ? I am using it with that basic code, with a MOTOR PROFILER GUI. I am trying to change the motor rotation periodicly (eg. after 3 period the direction of the rotation should change IMMIDIATELY) but with the help of the GUI it changes very slow... I would like to modify the code, I just do not know, which code should I download?

Can you please send me the basic source code for STM32G431CB , motor rotation?

Thank you in advance,

N.

This topic has been closed for replies.
Best answer by Vincent Onde

​Hello,

The source code is actually included and generated with the motor control development kit:

https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mcsdk.html

or

https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mcsdk-ful.html

for the full source code (requires registration). For modifying speed or doing reserval, the first version should be enough.

Best regards,

Vincent

8 replies

waclawek.jan
Super User
December 3, 2019

Are you talking about some particular devboard?

Isn't that code present in the examples in CubeG4 ?

JW

N_1
N_1Author
Associate III
December 4, 2019

Dear JW,

I am talking about this devboard:

0690X00000AtGhQQAV.png

It hs an STM32 on it, with an uploaded code on it, I just can find the code, I downloaded the examole package but still has no idea which one in it. The code is perfect, I just need little changes in it.

I am using the following GUI in this setup:

0690X00000AtGhVQAV.png

it works perfectly with it, so I am looking for that code.

Thank you

N_1
N_1Author
Associate III
December 4, 2019

The exact type on my kit: STM32F103C8T6

N_1
N_1Author
Associate III
December 4, 2019

Sorry The first post was the right one STM32G431CB

waclawek.jan
Super User
December 4, 2019

I've just downloaded the related CubeG4 and indeed, code for this board is missing. It's not on https://github.com/STMicroelectronics/STM32CubeG4/tree/master/Projects either.

I can't even find the binary.

@Amel NASRI​  , ST sells these boards as one of the Disco line, can we please have the usual support for it?

Jan

@Vincent Onde​ 

Amel NASRI
Technical Moderator
December 4, 2019

Hi Jan,

From B-G431B-ESC1 board page on ST web site, we see that we list both STM32CubeG4 and X-CUBE-MCSDK as embedded software.

I assume that this board is supported in the X-Cube package dedicated for motor control applications.

0690X00000AtH90QAF.png

 -Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
N_1
N_1Author
Associate III
December 4, 2019
Vincent Onde
ST Employee
December 4, 2019

​Hello,

The source code is actually included and generated with the motor control development kit:

https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mcsdk.html

or

https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mcsdk-ful.html

for the full source code (requires registration). For modifying speed or doing reserval, the first version should be enough.

Best regards,

Vincent

waclawek.jan
Super User
December 4, 2019

Hi Vincent, @Vincent Onde​ 

Thanks for the explanation.

Oh, it needs installing an .exe.... :( so the sources are not available for non-windows platforms... :(

As this is surprising for a board which is marketed together with the Discovery boards, can please this information be added to the place where the users would expect to find the code, i.e. into Projects under CubeG4?

And, of course, into UM2516 (and please don't make it into "modern feel and look").

Thanks,

Jan

N_1
N_1Author
Associate III
December 17, 2019

Thank you Vincent, now my motor is spinning with the right speed. Can you please explain to me how to control is reserval?

Vincent Onde
ST Employee
December 18, 2019

​Hello,

The speed is signed, if you use the void MCI_ExecSpeedRamp( MCI_Handle_t * pHandle, int16_t hFinalSpeed, uint16_t hDurationms ) function.

Just changing the speed sign will change the direction. But beware of the following note:

 * @note A ramp cannot reverse the rotation direction if the Application is using

 * sensorless motor control techniques. If the sign of the hFinalSpeed parameter

 * differs from that of the current speed, the ramp will not complete and a Speed

 * Feedback error (#MC_SPEED_FDBK) will occur when the rotation speed is about to

 * reach 0 rpm.   

Best regards,

Vincent

PS: @Community member​ I've asked to have the UM2516 updated as per your recommendations.​ Cheers, Vincent

N_1
N_1Author
Associate III
December 19, 2019

hello,

and what else could I use? I know if I wtop the motor and change the speed sign than it will rotate to another direction, I just need to change the direction immediately. Is there another function or a method to do it?

Thank you

Laurent Ca...
Senior III
June 28, 2021

Adding of STM32 Motor Control topic.

Best regards.