Starting STM8 Microcontrollers

STM8S003K3 Discovery

STM8 microcontrollers are 8-bit general purpose microcontrollers from STMicroelectronics (STM). STM is famous mainly for its line of 32-bit ARM Cortex microcontrollers – the STM32s. STM8 microcontrollers are rarely discussed in that context. However, STM8 MCUs are robust and most importantly they come packed with lots of hardware features. Except for the ARM core, 32-bit architecture, performance and some minor differences, STM8s have many peripheral similarities to STM32s. In my opinion, STM8s are equally or sometimes more matched than the popular PICs and AVRs in all areas. Unlike PICs and AVRs however, I have seen STM8s mostly in various SMD packages. Only a handful of STM8 chips are available in PDIP/through-hole packages. I think it is a big reason for which most small industries and hobbyists don’t play with them as much as with other 8-bit families. People like to setup their test projects in breadboards, trial PCBs or strip-boards first, prototype and then develop for production. To cope with this issue, STM has provided several affordable STM8 Discovery (Disco) boards to get started with. Besides there are many cheap STM8 breakout-boards from China.

STM8S003K3 Discovery

I have experience playing with AVRs, PICs, 8051s, STM32s, MSP430s, TivaC and so on. To be honest, I thought learning about STM8 micros is a pure waste of time and energy. The learning curve will be steep. Things and tools would be different and thus difficult. However, gradually I found these MCUs very useful and there’s literally no complexity at all. The main drive factor for learning STM8s is the price factor. They are hell cheap. When it comes down to other things, I have not found any book on STM8s written in English. There’s literally no 100% complete blog post on the internet that shows the basics. Similarly, same story with tools. I have been using MikroC for AVRs, 8051s and ARMs and it is my favourite but at the time of writing, there’s no MikroC compiler for STM8 family. I have also not stumbled upon any Arduino-like IDE that supports STM8 micros. Arduino-based solutions are also not my favourite as they don’t go deep and have several limitations. Maybe it is not my luck. After much study and search, I found out that there are a few C compilers for STM8s. However, any new tool is both different and difficult at first. It is not always easy to adapt to new environments. You may never know what unanticipated challenges and harshness a new environment may throw at you even when you reach certain levels of expertise. I also don’t want to use any pirated software and so a free compiler was a major requirement. I found out ST Visual Develop and Cosmic COSC compiler are both free tools. Cosmic used to be a paid tool but now it is absolutely free. The only easy thing till then was buying the STM8S Value Line Discovery board for just a few dollars and downloading the stuffs.

The STM8 Family

There are over a hundred STM8 microcontrollers available today. The STM8 family can be simplified into three categorical groups as shown below.

STM8 Family

There are subgroups within these groups but broadly speaking these three groups are what by which we can define the entire family. STM8S micros are general purpose robust and reliable micros that can be employed in almost all scopes. This is the most commonly used group and in fact we will be exploring it in this article. They are also cheap and smart. The second group – the STM8A family is intended mainly for automotive industries. This group is packed with additional hardware interfaces like CAN and LIN that are musts according to present-day automotive industry doctrine. The STM8As are also very robust and are designed to withstand the harsh extremes of an automobile. For instance, STM8As can withstand high temperatures, in excess of 100°C. The last group consists of STM8L micros which are crafted for low power or battery-backed applications. Virtually they consume no power in idle mode. Thus, if you need high power savings or energy cuts in your projects, this group is the best choice. There are also low power versions of automotive-standard STM8 micros that are labelled STM8AL. Apart from all these there is also one version of STM8 micros that are specifically designed for capacitive touch applications. These are called STM8Ts.

The features and benefits of STM8 micros are numerous and can’t simply be expressed in few words. The more you explore, the more you will feel. STM8s can be powered with 3.3V or 5V DC power supplies and have built-in brownout detection circuitry. The low power editions can operate at much lower voltages than these values. Official STM8 Discovery boards come with voltage selection jumpers to allow users to select operating voltage level as required. There is very minimum risk of program corruption due to EMI or some other similar unprecedented factors. There is fail-safe security for the clock system which ensures that a system based on a STM8 micro won’t stop working or stuck up should its external clock source fail. All internal hardware possesses more features than any other competitive 8-bit microcontroller families that are widely available in the market. The best part is the price benefit. You pay less for the most. All these features are well-suited for extremely harsh industrial environments. STM8s are designed with maximum possible combinations of features. Beyond your wildest wet dream, there are many extraordinary stuffs waiting to be unboxed.

Overview of the Discovery Board

For getting started with STM8s, STM has provided several STM8 Disco boards. There are also other third party boards too. However, I strongly recommend Disco boards for learning and experimental purposes. There are several reasons for this recommendation. One main reason is the fact that all Disco boards come with on-board detachable ST-Link programmers and they are extremely cheap. Shown below is the top layout of a STM8S discovery board.


The board I used here in this article hosts a STM8S003K3T6 micro. It is an 32 pin entry-level micro with 8kB flash, 1kB RAM and 128 byte true data EEPROM. It comes with some additional hardware – a LED connected to PD0 and a push button connected to PB7. Just as I said it also houses a detachable ST-Link programmer. However, I don’t recommend separating the programmer from the whole package. The board also has a prototyping area should one needs to prototype something. The overall board has a small form-factor and is a bit longer than a standard credit card. There are several other similar and popular STM8 Discovery boards like the STM8S105 Discovery.

STM8S105 Discovery

There are also bulks of cheap Chinese minimum system STM8 dev boards hosting different STM8 chips. Overall the boards and the chips are so cheap that many simple cheap gadgets from China are based on STM8 MCUs.

Cheap STM8 Boards

Some cheap STM8-based simple products are shown below:


The first one is a cheap DIY LC meter LC-100A. The other one is a simple DC panel meter. These are just simple examples. There are many industrial and sophisticated products based on STM8 micros.

Continue Reading ...

Related Posts


Leave a Reply

Your email address will not be published. Required fields are marked *