Software apps and online services
Hey, what's up, Guys! Akarsh here from CETech.
In the following tutorial, we will be looking at the different microcontrollers offered by STM like the STM32F103C8, STM32F030F4 and STM8S103F3. We will be comparing these micros to each other along with comparing them to the Arduino.
Once that is out of the way we will be converting the STM32F103C8 to an Arduino so that you can upload any Arduino IDE code to the STM32 using just a USB cable like you would with an Arduino.
Let us start with the fun now.Get PCBs for Your Project Manufactured
You must check out PCBGOGO for ordering PCBs online for cheap!
You get 10 good quality PCBs manufactured and shipped to your doorstep for 5$ and some shipping. You will also get a discount on shipping on your first order.
PCBGOGO has the capability of PCB assembly and stencil manufacture as well as keeping good quality standards.
Do check them out if you need to get PCBs manufactured or assembled.
So, according to the above comparison that I've drawn, let's summarise our findings:
1) The Arduino and the STM8s are 8-bit processors and the other two are 32-bit MCUs.
2) The STM32F103 has the largest flash memory which is double in comparison to the Arduino, whereas the RAM is 10 times bigger than that of Arduino.
3) The price of the powerfull STM32F103 is lesser than that of an Arduino Nano clone but in a comparable range. The STM8S103, on the contrary, makes its case as a cheap micro but definitely delivers lesser power.
4) Programming the Arduino is as simple as plugging in the USB cable and hitting the upload button in the IDE. The STM32 series do not have this feature out of the box but can be added to the STM32F103 by uploading the Arduino bootloader to it. Which is what we are going to do in the next steps :)Uploading the Arduino bootloader to the STM32
1) Connect the STM32F103 with an FTDI board as in the picture.
2) Switch the BOOT 0 header from the '0' position to the '1' position before connecting the FTDI board to the computer for flashing the bootloader
3) Download the appropriate bootloader(PC13 in my case) from the following link: https://github.com/rogerclarkmelbourne/STM32duino-bootloader/tree/master/binaries
4) Download and install the Flasher tool using which you can flash the binary: https://www.st.com/en/development-tools/flasher-stm32.html
5) Connect the hardware to the PC and open the flasher tool installed in the following location for my case:
6) Once the tool is open then select the correct COM port and proceed, in the next step when you see target readable message proceed to the next button twice.
7) Select the Download to device option then select the binary file located in your PC by clicking the 3 dots and then click the Next button which will upload the bootloader to the device and will show a success message like in the picture.
8) After closing the flasher tool, change the BOOT 0 jumper back to '0' position BEFORE removing power to the STM32 board.Setting up the Arduino IDE for STM32
1) Add the following URL to additional boards manager URL: http://dan.drown.org/stm32duino/package_STM32duino_index.json
2) Goto Boards Manager and search for STM32, once the list appears install the version from stm32duino.
3) Connect the STM32 board to the computer using a USB cable and select the correct board in the tools menu like in the picture above.
4) Now open any example sketch you want, I opened the Blink example and just hit the upload button and you will be able to upload the code without any other steps.That is it!
Try out different example sketches which should upload to the board as easily as the Blink sketch did.
Let me know in the comments below of how were you able to harvest the power of this board when used with the Arduino IDE, also for more clarification on the topic please do watch my video on the same topic: