Blog

STM32F103 SPL Tutorial 5 – SPI Interface

STM32F103 SPI

STM32F103 SPI (Serial Peripheral Interface) is a synchronous serial communication protocol. In this interface, in addition to transmit and receive lines, there is a third line that is used for clock line. Each slave device also has a chip select (enable) pin, that is used for activating the device. So to use SPI, we need 2 wires 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 bus

Continue reading “STM32F103 SPL Tutorial 5 – SPI Interface”

STM32F103 SPL Tutorial 4 – Create a Delay Function with System Timer

STM32F103 System Timer

STM32F103 System Timer or SysTick is a timer inside the CPU. SysTick is a basic countdown timer. SysTick can be polled by software or can be configured to generate an interrupt. To use SysTick, we must load a value to the reload value register. The width of reload value register is 24-bit, so it can counts from 0x00FFFFFF to 0. In this tutorial, I will explain how to use SysTick for creating a delay function. SysTick can be configured through the registers below.

SysTick register

Continue reading “STM32F103 SPL Tutorial 4 – Create a Delay Function with System Timer”

STM32F103 SPL Tutorial 3 – GPIO Read Button

STM32F103 GPIO

In this tutorial, I will explain how to use STM32F103 GPIO for reading a push button. STM32F103 GPIO can be configured in 4 different modes (input mode, output mode, analog input mode, and alternate function mode). For reading a button, we need to configure a GPIO pin in digital input mode.

STM32F103 GPIO input

Continue reading “STM32F103 SPL Tutorial 3 – GPIO Read Button”

STM32F103 SPL Tutorial 2 – GPIO Write LED

STM32F103 GPIO

STM32F103 GPIO are generic pins that can be configured as input or output. In this tutorial, I will explain how to use STM32F103 GPIO for controlling an LED on/off. STM32F103 GPIO can be configured in 4 different modes (input mode, output mode, analog input mode, and alternate function mode). For controlling an LED on/off, we need to configure a GPIO pin in output mode.

STM32F103 GPIO

Continue reading “STM32F103 SPL Tutorial 2 – GPIO Write LED”

STM32F103 SPL Tutorial 1 – Create a New Project in Keil uVision IDE

STM32F103

STM32F103 is an STMicroelectronics’s 32-bit microcontroller based on the ARM Cortex-M3 processor. The processor clock speed is up to 72MHz. It has 64 Kbytes of flash memory and 20 Kbytes of SRAM. There are several development boards for this microcontroller available on the market. In this tutorial, I will use this development board. It has 40 pins that fit into breadboard. It has 2× 12-bit ADCs, 7× timers, and Up to 9 communication interfaces (3× USART, 2× I2C, 2× SPI, 1× CAN, 1× USB).

STM32F103

Continue reading “STM32F103 SPL Tutorial 1 – Create a New Project in Keil uVision IDE”