Can I use Arduino IDE with this STM32 MPU and Programmer?

I have been making a few projects with my Arduino Nano V3 the past year with Arduino IDE, and have received nice help in this forum. Now I like to try something a bit more advanced. I have noticed, that more people working with robotics and BLDC motors with FOC prefer to use STM32 processors. STM32G431 is often used.

About a half year ago I got some electronics from China, and decided to buy a STM32 board and programmer from same shop, just to see if I might be able to make use of it. And now I got some time for experiments with it. I hope for some help to get started - just so I can upload a blink program and to get out some serial data to the PC via USB.

The processor is called: STM32G030C8T6
The Programmer is called: STC Auto Programmer USB-TTL

This is a photo of them:

I have seen a lot of instructions about how to program a Blue Pill board, but this is not a Blue Pill. I have loaded libraries regarding the STM32 into the Arduino IDE. However I am concerned about the Programmer, and I am not sure to set the Arduino IDE correct to use it correctly. Nothing says anything about "STC Auto Programmer".

When I look this drop-down menu, I see a lot of settings about Upload method, USB support and U(S)ART support. Do I need to set them in specific ways for this Programmer to work?

I have also read some horror stories, that the 64 kbyte flash storage of this processor should not be sufficient for the communication programs needed. Can it be true?

From your pictures, looks like the programmer you have will not easily connect to your STM32 board. Also, your board appears to have a USB port attached. In my experience with other microcontroller breakout boards, the USB port is used to directly program the board.

See about gathering more information about your controller board. Especially look for information related to programming it.

Good luck with your project.

When I read about these STM32 based boards, they cannot be programmed directly by the USB port. They need some programming interface, that is often called a programmer.
The seller of this board got a bit documentation, and it states that the USB-port is for power only:
https://vi.aliexpress.com/item/1005004350343469.html

I do have wires to connect the board and programmer, but I cannot find out how, because names do not match what I can find elsewhere. But perhaps this programmer I got is not suitable. I do not see any clock pin on it. The pins are named as some old serial RS232C interface. Some limited information can be found here:
https://vi.aliexpress.com/item/1005001609276573.html

It seems that many use the STlink V3 programmer now, and perhaps I need to get that. But they got more versions as well. With the Arduino IDE you can select one of four types of STM32CubeProgrammers, that might apply.

If you have an STM32, what's the point of using the Arduino IDE for everything?
And if you really want to do "more advanced things," why not take full advantage of those chips and download STM32CubeIDE and STM32CubeProgrammer?

to program the device, you need to enable de SWD interface

Thanks for your reply.

The only reason is, that I know the Arduino IDE already and some of the Arduino library functions like millis(), micros(), analogRead(), digitalWrite(), Serial.print(). I guess that I need to learn other similar functions in a new environment, and a new IDE.

I have seen more references on how to get started with STM32CubelIDE and STM32CubeProgrammer. I did however also see an initiative to use Arduino IDE called SM32duino. But the forum about that seems not active anymore. So part of my question about this is also to find out, if using the Arduino IDE in this context is worth the effort. It seems that you recommend not to use Arduino IDE for this purpose.

Hi @backflip.

It is a bit of a stretch to call that a "programmer". This is simply an adapter that produces a virtual COM port on your computer via the USB connection and then converts that interface to TTL UART communication. So it can be used as a "bridge" between the computer and a microcontroller (or any other device that uses UART communication).

Usually when we talk about a "programmer" device, we are referring to something that is capable of directly writing binaries to the microcontroller's flash memory (e.g., the STLINK-V3).

The "STC" thing you got is definitely a useful tool for communication with your STM32G030C8T6 dev board, but you aren't going to be able to use it to flash a bootloader binary to the microcontroller, and you also won't be able to use it to upload sketch programs to the microcontroller unless the microcontroller already has a suitable bootloader installed.

It is just some random branding the Chinese manufacturer screen printed onto the case. You will find the same exact hardware sold on the various online marketplaces with various different branding. Under the hood it is just a WCH CH340 chip with the basic support components. So don't poison your searches by adding irrelevant keywords like "STC".


Something that is very confusing is that the Chinese also make ST-LINK/V2 clones (which are truly "programmers") in the exact same form factor as the "STC" USB to serial adapter you got. Sometimes the sellers of the USB to serial adapters even add terms like "ST-LINK" to the title or description of the product listing, even though the USB to serial adapters are completely different hardware than an ST-LINK. So you might find tutorials on the Internet where people are using something that looks almost exactly like the adapter you have to successfully program or debug an STM32 board.

I can tell you that the reasonably priced STLINK-V3MINIE works perfectly as a programmer when used with the "STM32 MCU based boards" Arduino boards platform (AKA "STM32duino").

I have only used it with the more common STM32F103C8 dev board ("Blue Pill") that I have on hand, so I can't say for certain that it will work with your STM32G030C8T6 board, but I don't have any reason to think it wouldn't work.

I use the Tools > Upload method > STM32CubeProgrammer (SWD) configuration.

I think Tools > Upload method > OpenOCD STLink (SWD) would also work, but unfortunately that configuration can't be used on Windows computers, only on Linux or macOS machines.

The "STM32 MCU based boards" platform (AKA "STM32duino") is maintained by manufacturer of the STM32 microcontrollers, STMicroelectronics.

That forum isn't super busy, but it certainly isn't accurate to say "not active anymore":

It is absolutely worth the effort. Many members of the Arduino community use Arduino IDE and the "STM32 MCU based boards" platform with their STM32-based boards and have created a tremendous number of amazing projects.

Of course there are excellent alternatives to Arduino IDE, but if you want to use Arduino IDE with your board then you can definitely accomplish that if you just put in the effort to get the right hardware sorted out.

If you want to go on easy mode, get one of the NUCLEO boards manufactured by STMicroelectronics. These have a built in STLINK-V3 which acts as a programmer, USB to serial interface, and debug probe. They are available for a very reasonable price.

Alternatively, you might take a look at Arduino's own GIGA R1 WiFi board. This board uses the STM32H747XI microcontroller, which has significantly more resources. The Arduino company provides Arduino IDE support for this board through the official "Arduino Mbed OS Giga Boards" platform. When using the GIGA R1 WiFi, you just connect it to your computer with a USB cable and you are all set to upload sketches and communicate over serial without any need to worry about connecting some external programmer to the board.

Thank you very much for your answers!

Thanks. When I purchased this "STC" thing I had no idea, what was right or wrong about it. So I am glad to know, that I will not waste time on trying to make it work on this board.

Thanks for this info about STM32duino. I tried to be part of the forum there six days ago, and my confirmation is still pending. If I try to send them a message, they make the statement, that it is normal, that you have to wait for confirmation - so don't write to us about it. Anyway I am glad, that you can confirm that the work about this is not abandoned.

Yes, in the mean time I have been informed about that too. I have been recommended to get MCU for BLDC motor FOC with STM32G4xx processors. I found three NUCLEO boards, that I think might be attractive for that, and especially:
https://www.st.com/en/evaluation-tools/nucleo-g474re.html

So I am going to try that, and I may forget about my board with STM32G030C8T6.

I have tried to look the specifications on this MPU. It is a fast processor with a lot of memory and a double precision FPU. But the specs seems to specify no ADC, and I think I need at least two ADCs to measure currents for motor FOC control. The only "normal" Arduino MCU I found with with two ADCs is the ESP32. The STM32G474 have got five ADCs and six internal Op-amps.

Hi.

I can tell you that the reasonably priced STLINK-V3MINIE works perfectly as a programmer when used with the "STM32 MCU based boards" Arduino boards platform (AKA "STM32duino").
I have only used it with the more common STM32F103C8 dev board ("Blue Pill") that I have on hand, so I can't say for certain that it will work with your STM32G030C8T6 board, but I don't have any reason to think it wouldn't work.

Yes, it can. I have the STLINK-V3MINIE and I have used it to program the STM32G030F6P6, STM32C011F4U6 among others without any problem.

I have tried to look the specifications on this MPU. It is a fast processor with a lot of memory and a double precision FPU. But the specs seems to specify no ADC, and I think I need at least two ADCs to measure currents for motor FOC control. The only "normal" Arduino MCU I found with with two ADCs is the ESP32. The STM32G474 have got five ADCs and six internal Op-amps.

The STM32H747XIH6 has 3 16-bit ADC and 2 OpAmps

1 Like

Yes, you are right. I looked only at the main specifications table here:
https://www.st.com/content/st_com/en/stm32-mcu-product-selector.html

For some odd reason these tables are not complete. But when you look into the detailed description, you find more.

I did also look a bit on the STM32Hxxx processors with the Nucleo boards. I did not find the H747 processor among them. I did find H563, H723, H753, H755, H7A3, H7S3. However I did not see any other better analog performance.

Thank you for the heads up about the Arduino Giga.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.