Tag Archives: STMicroelectronics

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 with 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 Plastic Dual-Inline Package (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

Read more

STM32’s internal RTC


A Real Time Clock (RTC) is a timing element dedicated for keeping time. In many applications, especially where precise timed-operations are needed to be performed, a RTC is a very useful tool. Examples of such applications apart from clocks and watches include washing machines, medicine dispensers, data loggers, etc. Basically a RTC is a timer-counter but unlike other timers of a MCU it is much more accurate. Previous to this post, we explored STM32 timers but those were useful for applications like PWM generation, time-bases and other waveform-related tasks. Those were not suitable for precise time-keeping. In most 8-bit MCUs like the regular PICs and AVRs, there are no built-in RTC modules and so we need to use dedicated RTC chips like the popular DS1302 or PCF8563 when we need an on-board precise time-keeping device. Those chips also need some additional circuitry, wiring and circuit board space. At present, however, most modern MCUs come packed with literally every possible hardware a designer may think of. It is only up to a designer to decide which resources to use from a modern-era micro to meet a specific design goal. Gone are the days when MCUs were manufactured for application specific requirements and also gone are the days of implementing and involving multiple assets in a design. Thus cost, time and space are dramatically reduced, resulting smarter, sleeker and smaller affordable devices. Fortunately STM32s are in that list of those modern era microcontrollers. STM32 MCUs come with built-in RTC modules that require no additional hardware support. This tutorial covers basic features of STM32’s internal RTC and  how to use it for time-keeping applications.


Read more

STM32 Digital-to-Analogue Converter (DAC)

Block Diagram

After having played with Analogue-to-Digital Converter (ADC) of STM32 micros, the obvious next internal hardware block to deal with is the Digital-to-Analogue Converter (DAC). As the name suggests this block has just the complementary function of ADC. It converts digital binary values to analogue voltage outputs. The DAC block has several uses including audio generation, waveform generation, etc. Typically in most 8-bit micros, this block is unavailable and its need is somewhat loosely met with Pulse Width Modulation (PWM) block. This is partly because of their relatively less hardware resources and operating speeds. All STM32 micros also have PWM blocks but large capacity STM32s have DAC blocks too. The STM32 DAC block is not very complex and has similarity with the ADC block in terms of operating principle. The simplified block diagram below shows the major components of the STM32 DAC block.

Block Diagram Read more

« Older Entries