Skip to main content
KDIAS.2340
Associate II
November 30, 2019
Question

I want to use the STM32G474VET6 in a robotic application with 3 motors and a diff GPS. Can I program it in Assembly or do I use C? If the latter is Keil a good compiler?

  • November 30, 2019
  • 24 replies
  • 6203 views

..

This topic has been closed for replies.

24 replies

berendi
Principal
November 30, 2019

You can program it in assembly or in C, or mix them as you like, even within one function.

Keil is a very good compiler if you can afford it, or you are confident that the code size will never reach 32 kilobytes. Otherwise, STM32CubeIDE or Eclipse CDT with the GNU-MCU-Eclipse plugin are good choices. All of them support both C and assembly.

KDIAS.2340
Associate II
December 1, 2019
I assume the latter 2 are free. How to get them? Thanks
Clive1 (HNL)
Explorer
December 1, 2019

There were links, click them

S.Ma
Principal
December 1, 2019

Embedded C compilers are good enough that 98% of the time you won't need to down to ASM level.

When knowing how the compiler works and knowing how the core function helps you to write C style with predictable ASM code generation.

And you shall have 20% more flash that needed to disable the compiler optimisations so you can easily put breakpoint and look at human readable ASM code in the debug window when necessary.

The only ASM instruction I use is NOP to place breakpoint hooks (for example in switch case places) and SW delays, and to temporarily disable interrupt (save the interrrupt level in stack, disable, then pop it.

Piranha
Principal III
December 1, 2019

DMB, DSB, WFI, CLZ, REV, REV16, REVSH, RBIT are also quite necessary in non-trivial projects.

Pavel A.
Super User
December 8, 2019

> DMB, DSB, WFI ....

You don't need assembly, all these are CMSIS -defined intrinsics for all major compilers. -- pa

KDIAS.2340
Associate II
December 3, 2019

Just wonder - is there sample code already available to do this - it is trivial i.e. controls 3 motors only. which is better for a beginner ~STM32CubeIDE or ECLIPSE CDT?

Tesla DeLorean
Guru
December 3, 2019

Most places engage an engineer or developer to code the trivial and assembler based stuff.. I use Google to mine the interwebs and git.

CubeIDE is presumably where all the resources are being thrown, forum traffic indicates a mixed level of success, as the teething issues are resolved, and projects/importation issues are addressed.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
KDIAS.2340
Associate II
December 4, 2019

Doesn't answer my question i.e. is there sample code in the public domain that I can modify and use in my application?

Tesla DeLorean
Guru
December 7, 2019

It is a relatively new part, and the "motor nuts" aren't huge into community, as most of what they build is work product.

The CubeG4 repository should have what ST is offering.

https://www.st.com/en/embedded-software/stm32cubeg4.html

Look at some of the motor dev boards, and chat with the FAE's covering motor topic.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
KDIAS.2340
Associate II
December 8, 2019

Thanks. I tried contacting AVNET here in Toronto and although within working hours no one picked up. If you can suggest motor dev boards, would appreciate.

Piranha
Principal III
December 7, 2019

Also, saying only "robotic application with 3 motors" and not mentioning what type of motors and drivers, does make it impossible to suggest anything useful...

KDIAS.2340
Associate II
December 8, 2019

These are regular brush dc motors 12 V, 2 are the same around 2A each , third is smaller 1.6A

KDIAS.2340
Associate II
December 11, 2019

A beginner's question; How to program the 32G4, is it through the UART and if so which terminals to use?

Tesla DeLorean
Guru
December 12, 2019
Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
KDIAS.2340
Associate II
December 16, 2019

Thanks. Still trying to figure it out. Here is a pic, I think it is the 2-row connector to the left of the micro.0690X00000Bug4GQAR.jpg

Tesla DeLorean
Guru
December 16, 2019

The connector and silk-screen suggest it is a 20-pin JTAG header, would connect to an ST-LINK/V2 or J-LINK type pod.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
KDIAS.2340
Associate II
December 16, 2019

sorry, but what is ST-LINK/V2 or j-LINK

KDIAS.2340
Associate II
December 18, 2019

How to find out if it is ST-LINK or J-LINK?

Tesla DeLorean
Guru
December 18, 2019

Either, should I Google this stuff for you?

It is a header you'd plug the aforementioned debug pods into.

Perhaps you could refer to the schematic for your board, of docs from its manufacturer.​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
KDIAS.2340
Associate II
December 18, 2019
tHANKS