Page 1 of 1

How to start with STM32duino - STM32G030F6

Posted: Wed Jan 19, 2022 11:18 am
by novakkry
Hi! A newbie questions here. I wanna use STM32G030F6 [1] for my project. I don't want to use any development board, but bare standalone chip with internal oscillator. Now my questions. How do I do it using STM32duino?

I've found out that STM32duino supports STM32G030F6 as it was added last month to the supported boards (generic STM32G030F6 [2]). How do I start now? In Arduino IDE I can find the board and I can compile a code for the board but I have no idea what are, for instance, GPIO pins called in Arduino world. Also, the chip has two hardware serials. If I simply use "Serial.begin(xxxx)" what serial on what pins will it use? How to use the second serial? Does Arduino supports that?
I want to use the internal oscillator so I have fewer components on the board. Do I have to somehow tell to compiler to compile it for the internal oscillator on the specific frequency or I just compile it as is?

I wanna program the STM32G030F6 using SWD with ST-link V2.

I just don't know how to start with STM32duino as I don't fully understand the concept. I've always done projects with Arduino Uno or standalone atmega328p-au.

I'll greatly appriciate any suggestions and advices. Thank you.

Krystof

[1] https://www.st.com/en/microcontrollers- ... l#overview
[2] https://github.com/stm32duino/Arduino_C ... xx/G030F6P

Re: How to start with STM32duino - STM32G030F6

Posted: Wed Jan 19, 2022 4:05 pm
by fpiSTM

Re: How to start with STM32duino - STM32G030F6

Posted: Thu Jan 20, 2022 5:33 am
by ag123
for beginners get a bigger chip and board
select one on the list that has >= 64k flash and >=32k sram.
https://github.com/stm32duino/Arduino_C ... -64-boards
e.g. STM32F401RE Nucleo F401RE or
STM32F411RE Nucleo F411RE
is a decent board and chip

STM32G030F6 has too little sram and flash and most 'beginners' will stumble over trying to make it work.
and for beginners always start with a board that is on the list that has ram and flash specs given above
https://github.com/stm32duino/Arduino_C ... -64-boards
this is because the other thing that most beginners stumble over is not knowing how to configure the clocks so that usb serial would 'just work'

if you get a ST Nucleo board the st-link is built onto the board, it is plug and play. for 3rd party boards e.g. blackpill f401ccu, you would need to buy your own st-link separately (for debug mostly, and programming).

small chips such as STM32G030F6 32k slfash 4k sram are for the 'experts', as you will have a hard time squeezing the firmware in there.
and your app will most likely hardfault in that 4k sram as the stack crashes with global variables.
the 'experts' would know how to modify the core to reduce the dependencies to only those that they specifically use, not even the full set of pheriperials offered on chip.

Re: How to start with STM32duino - STM32G030F6

Posted: Thu Jan 20, 2022 8:19 am
by GonzoG
Like ag123 wrote, better choose different MCU.
Deafult setup with UART and USB needs more then 32KiB of flash.

As to using your own board, you'll need to edit files from "generic" board so they will apply to your hardware setup.
As to pins, they are called the same as on any MCU: eg. PA1, PB5, etc.
Answers for most questions you'll find here: https://github.com/stm32duino/wiki/wiki