My first serious work with STM processors as powerful ARM-based Arduinos started with ST32L071 and is documented here. As part of that article, I found a way to integrate a custom board into the Arduino environment and how to use the ST-Link to upload a sketch from the Arduino IDE. Satisfied as I am with that work, I realize that no one is likely to build any of my L071 based Arduinos, even if they can be itsy-bitsy, low power, etc. However, my work may still be very useful!
Let's talk about the WeAct Duino. As discussed in the Description section above, the STM32G431 on the WeAct Mini Core Board offers a lot of power along with many peripherals. WeAct offers this unit at a very affordable price - less than three bucks! (Even in quantity, the G431 chip from Digikey costs more than the cost of the system from WeAct. How can they make it so cheap? Who knows! But we can all benefit!) While the G4xx draws more power than the L0xx, it is an M4 core with floating point hardware, runs over 4 times faster, and has additional resources. The version from WeAct is in a 48 pin package, so more of the resources are accessible. ST Nucleo versions of the G431 are available from Digikey (and others). The 32 pin version costs $12 and the 64 pin version is $16. Both are significantly larger than the WeAct board, but not any more powerful (same chip).
As a useful bonus, WeAct also offers a clone of the ST-LINK_2.1 programmer. Not only does it cost half what the cheapest ST version costs, it also provides a serial interface. The usual sort of Serial.print() debug can be easily used for program debug; for harder problems, gdb (g-debugger) can be invoked as described here (but it might be broken also - not sure)??
So lots of reasons to love the G431, but how do we use it as an Arduino?? That brings us back to my work on the L071! As mentioned above, that project is currently broken. It will be fixed soon and the documentation will be directly applicable to the G431. In the paragraphs to follow, I will explain how to make the G431 into an Arduino: WeAct Duino!
Let's have a look at the hardware side. WeAct supplies dual rows of square pins to be soldered into the holes in the board, but I wanted something that could plug into a breadboard. I used Arduino connectors on the inside rows and standard square pins on the outer rows as shown.
Now I can plug the WeAct Duino into a breadboard if I want and still have a row or two of connections available for each pin.
WeAct kindly provides pdf versions of the schematics and the board layout. These are very helpful in understanding the design and how to use it effectively. I've included these in the Files section.
The files that actually define a board to the Arduino IDE are those in the variant directories. This is all (or soon will be) explained in the revisions to the tDuino prject referenced above. For now, know that the necessary files (which you will put in place in a few paragraphs) have been suitably modified for the WeAct Duino. The external 8MHz clock crystal on the WeAct board is implemented as the system clock source. The WeAct Duino board runs at 170MHz.
To assist in understanding and using the resources of the WeAct Duino, I created a map of the pin functions. This is WeAct_Pin_Map.png in the Files section, and will be used as a guide to experiments in the Project Logs to follow.
Final hardware note: There are still a few details of the WeAct board that are not clear to me. I am still investigating and will report as I learn.
Hardware ready, let's look at software. Although I will explain all the steps I went through to add the WeAct Duino to the Arduino IDE (as part of the update to the tDuino project), I've provided the necessary files so you can just copy them and go. I'm now running Ubuntu 18.04, but this should work with other recent versions and operating systems. My Arduino version is 1.8.15, but more recent versions should work also. (However, I haven't tried Arduino 2.0...
Read more »
Thanks , some thoughts , imho :
1) I don't now what could be the + of WeAct Duino , as stm32duino supports the chip , and can give support on the forum or on github
2) there is no need for ST-Link , the chip can be natively programmed in DFU mode through USB , and CDC mode can be selected in order to interact with the monitor . Nevertheless , one have to push the boot0 and the rst buttons before each upload ; I have connected the boot0-PB8 to 3v3 , so I just have to push the rst button ; it is better to close the monitor before uploading ; yes , one have to install STM32CubeProgrammer before
3) i have got old $3 stlinks , with STM32GC102CB chip : they can be upgraded for G4 , there is a good video how to
4) they are "forbidden" pins :
// PA11 , PA12 : USB , not on the headers
// PA13 , PA14 : SW (ST-Link)
// PG10 : NRST ; PB8 : BOOT0
// PC14 , PC15 : OSC32
// PB4, PB6 , PA10, PA9 : USB C : The pull-down effect on the CC lines can be removed by using the bit UCPD1_DBDIS =1 ??? I have to clarify ...
5) it has 5 u(s)arts ; didn't try lpuart ; and yes , much more
6) the reason why the board is cheap is that the chip itself is cheap in china : 100+ US$1.451 at LCSC ; maybe a commercial effort from ST , in order to fight the clones ; so , not the perfect arduino , but one of the top bests