Ads

Get STM32 tutorial using HAL at $10 for a limited time!

Monday, April 25, 2016

ARM Cortex-M3 (STM32F103) Tutorial - SPI Master

In this tutorial, I will explain about SPI communication protocol and how to use it on STM32F103 microcontroller. SPI (Serial Peripheral Interface) is a synchronous serial communication protocol. With SPI, in addition to transmitting and receiving lines, there is a third line that used for clock line. Each slave devices also has a chip select (enable) pin. These pin is used for activate the slave devices. So, to use SPI, we need 2 wire for data lines (MOSI, MISO), 1 wire for clock line, and 1 wire per device for chip select line. MOSI (Master Out Slave In) is used for data transfer from master device to slave device. MISO (Master In Slave Out) is used for data transfer from slave device to master device.


SPI communication is different from other serial communication especially on data transfer. There are no concept like transmit and receive data, but there is a data trading concept. When data trading occurs, the data bits in master register is traded with the data bits in slave register on every clock from master (one data bit per clock tick).

Saturday, April 23, 2016

ARM Cortex-M3 (STM32F103) Tutorial - LCD 16x2 Library

In this tutorial, I will share about LCD 16x2 library. With this library, you can easily use LCD 16x2 with STM32F103 microcontroller. This library contain 2 file: lcd16x2.h and lcd16x2.c files. If you want to know the more detail how the LCD 16x2 works, you can see this tutorial.


Saturday, April 16, 2016

ARM Cortex-M3 (STM32F103) Tutorial - FreeRTOS - Task

In this tutorial, I will share how use an RTOS on STM32F103 microcontroller. I use FreeRTOS for this tutorial. RTOS is usually needs when an embedded system must responds to an event within a strictly defined time.


In this tutorial, I will make RTOS task with 3 LED that blinks at different frequency. First thing to do is to download FreeRTOS library. The next step is to make a new project in Keil uVision and setup the configuration for using FreeRTOS on STM32F103.