Introduction to embedded programming on STM32
General info
STM32 is a modern family of MCUs produced by STMicroelectronics that is widely used in research, consumer and industrial electronics. STM32 microcontrollers are quite powerful and cheap, but impose initial barriers to get started quickly.
The purpose of the course is to overcome these barries and steadily get into the topic. This course will help to develop basic understanding of Cortex-M0 core and STM32F0 peripherals.
To get to the content of lectures and supplementary materials for the course, refer to Wiki page.
If you need just a template project, refer to Blank project.
Syllabus
-
Toolchain for embedded programming. ARM architecture cross-compiler. On-board debugger. Boot modes. Boot-loader. Configuration bytes.
-
CPU core. Memory map. Registers. Microcontroller system architecture. Memory organization: static RAM (SRAM), peripheral memory, system memory.Code execution: interrupt table, stack, heap.
-
Reset and clock control (RCC). Clocking signal. Rising edge, falling edge. Clock sources: HSI, HSE, PLL. Clocking map of stm32f0. Memory latency. Reset system.
-
General-purpose input/output (GPIO). Structure of GPIO. Input floating. Input pull-up. Input push-down. Shmitt trigger. Contact debouncing. Analog input. I/O alternate functions. 7-segment LED. Dynamic indication.
-
Nested vectored interrupt controller (NVIC). System and peripheral interrupts. Event-handling policies: polling, interrupts. Interrupt handling: frame stacking, frame unstacking, nested interrupts, tail-chaining, late-arriving. Interrupt priority and status. Interrupt vector table.
-
Extended interrupts and events controller (EXTI). System timer. Internal structure of EXTI module. EXTI configuration. Internal structure of a system timer: counter, reload value, control and status registers. SysTick configuration. Encoder.
-
General-purpose timers. Counter structure: counter register, pre-scaler register, auto-reload register. Counter timing diagram. Counter modes: upcounting, downcounting, up/down counting. Timer configuration. Input capture.
-
Encoder support. Pulse-width modulation (PWM). Incremental encoder operation. Encoder interface mode of a timer. Output compare mode of a timer. Pulse-width modulation, duty cycle. Edge-aligned PWM, center-aligned PWM. Piezoelectric buzzer and PWM-based sound generation.
-
Universal synchronous and asynchronous receiver-transmitter (USART). Communication directions: simplex, half-duplex, full-duplex. USART signaling scheme: start bit, data bits, parity bit, stop bit. USART configuration: baudrate, endianness, oversampling. USART interrupts.
-
Direct Memory Access (DMA). DMA transactions. Internal structure of DMA module. DMA transfer parameters: peripheral and memory adresses, circular mode. DMA interrupts.
-
Real-time clock (RTC). Internal structure of RTC module. Time representation, binary-coded decimal (BCD) format. Alarm clock implementation: masking, interrupts.
-
Inter-Integrated Circuit bus (I2C). I2C signaling: data pin (SDA), clock pin (SCL), baud rates, addressing, timings. I2C module internal structure. Connection of EEPROM and OLED-display over I2C.
-
Serial Peripheral Interface (SPI). SPI signaling: MISO and MOSI pins, slave select pin, clock polarity. Internal structure of SPI module. SPI communication modes: simplex, half-duplex, full-duplex, multi-slave, multi-master. Recieve and transmit queues (RXFIFO, TXFIFO). SPI interrupts. Shift register.
-
Analog-to-digital (ADC) and digital-to-analog (DAC) converters. Successive approximation ADC structure. Internal structure of ADC and DAC modules. ADC operation: clock source, calibration, sampling time. Data alignment. ADC operation modes: single conversion, continious conversion, discontinious mode. ADC operation diagrams. DMA usage. Temperature sensor and reference voltage.
-
Low-power mode. Sleep mode, stop mode, stand-by mode. Clocking domains.
-
Introduction to Operating Systems. Finite State Machine (FSM). Basic OS. Real-Time Operating System (RTOS). FreeRTOS: tasks, scheduler, priorities. Inter-Process Communication (IPC): mutex, semaphore, notificator. Critical section. RWM-operation. Deadlock. Message queue.
-
STM32 Microcontroller Ecosystem. ST-Link. Microcontroller evaluation boards: STM32F0-Discovery, minimal STM32F0 board, STM32F1 Blue Pill, STM32F4-Discovery, STM32G0 board. Printed circuit board production software. Libraries overview.
Contacts
Should you have any questions, feel free to contact via e-mail with subject "STM32 course".