ADC block

It’s been nearly one year since I posted the last tutorial on using STM32F0 UART. Many things have happened during my study that gave me no chance to release any new tutorial. But I finally finished my MSc course and having some free time so I make up my mind to go back and continue with what I am interested here instead of watching cats’ and dogs’ videos on Youtube  :-P. In this post, I’ll talk about STM32F0 ADC.

Specifically, I will cover almost every part of Analog-to-Digital Converter (ADC) module of STM32F051 on STM32F0 Discovery board using HAL library with support from STM32CubeMX. This is applicable for other low level STM32 series as their ADC module are quite similar. I will try to cover: Fundamental knowledge of ADC; Single channel/sequence conversion, continuous and discontinuos ADC conversion with/without interrupt;

Two examples will be given: I will first try to measure the supply voltage for the STM32F0 chip, which is also the reference voltage for ADC module. Then, an example of reading the chip’s temperature using built-in temperature sensor as well as reading external analog voltage applied to analog input pin (PA1) will be made. To view the ADC conversion data and other internal variables, I will use STM Studio which has been introduced in this post.

Read More →


This guide will explain how to take a Logo (or other simple image), that is in a digital format (BMP, JPG, PNG, etc), and turn it into a 2-tone Silk Screen Overlay in Altium Designer. The guide was created with AD10 but the process should be similar for other versions of Altium.


Read More →

STM32F0 Uart connection

It’s been a while since I posted the tutorial on using STM32F0’s timer and counter. I’ve recently started my MSc course in NUS and found it quite challenging. I almost forgot all the maths, formula, calculation that I studied in university after 2 years working. I’ve been spending most of my time reviewing old lessons, absorbing new lectures. But today I’ll set them aside and enjoy my time here with the STM32F0 UART tutorial.

Read More →


As said before, I will explore the Timer and Counter of STM32F0 using CubeMX in this post. In this STM32F0 timer tutorial, I will try to cover as many functions of the STM32F0’s Timer as possible because this peripheral may have the greatest features, functions among the other peripherals. If you have worked with Arduino before, you might realize the limitation in function of those arduino’s timers. However , the STM32’s timers will give you way more functions that will be very useful for many of your applications that you may not think about it before. For STM32F051, it has totally 9 main timers including 7 16-bit timers, 1 24-bit systick timer and 1 32-bit timer. Some of them have 6 channels advanced-control PWM output, deadtime generation… It also has independent and watchdog timer for dealing with program hanging. This tutorial will cover the following function of the timer:

  • Time base interrupt function
  • Counter with external input
  • Input capture
  • PWM generation

Read More →


In the previous tutorials, I have shown how to use the simple GPIO and external interrupt of the STM32. Since these peripherals are connected with external pins, we can visually observe how it works through some LEDs of the Discovery kit. Therefore, it is very easy to know whether our code is working correctly or not. However, when you are playing with some kinds of internal peripherals such as Timer/Counter, UART,… with types of data are not bit anymore but byte or integer or float, you will need something else to diagnose that data. Typically, the programming environment like Keil or IAR provides us a debugging tool to debug those kinds of data in real time but I found they are not so convenient and user-friendly at all. So, to prepare for our next tutorials, which will be more about internal peripherals, I am going to introduce you to the STM Studio from STMicroelectronics.

Read More →