Hi everyone, I’m back 😀 Another year has come with lots of opportunities and challenges presented to me as I now become a fresh PhD candidate at Nanyang Technological University (NTU) Singapore. Being occupied by all the courses and my research, I hardly had time to continue with the STM32F0 tutorial series I started almost two years ago. However, we have come a long way to finish almost all the basic aspects of the STM32F0 chip including the GPIO, Interrupts, Timer, Counter, PWM, UART and ADC. Only few peripherals including I2C, SPI, DAC, TSC and WDG are left to be discovered. Hence, I thought that I need to spent some time to continue with this tutorial series to finish all the basic peripherals. Moreover, I have recently received free samples from ICStation, which are some I2C sensor and OLED screen that gave me more motivation to do this STM32F0 I2C tutorial.
Therefore, in this tutorial, I will be covering the following parts:
- Some basic ideas of the I2C and when we need to use it.
- Overview of the I²C peripheral of the STM32F051 on the STM32F0 Discovery kit.
- An example showing how to connect and read data from a temperature and humidity sensor (HDC1080) through I²C port and then, display the temperature and relative humidity on an OLED screen (SSD1306 controller), also through the same I²C port.
- Finally, another example to show how to set up two I²C modules of the same STM32F0 (1 master, 1 slave) to transfer data with each other. Let’s get started.
Read More →
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 →
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 →