
Introduction to the Embedded Software Development using C++ course.
This lecture contains materials such as technical documentation and installers for resources required to follow the course.
For the components required to follow the exercises and projects in this course, links are provided to where they can be ordered.
Bitwise operations are important in writing embedded software (especially firmware). This lecture reviews some bit manipulation operations.
In this lecture, we'd talk briefly about CMSIS and a few things it can be used for
This lecture gives an explanation on the hardware abstraction layer (HAL) as well as its advantages and disadvantages.
This lecture discusses the idea behind object-oriented programming.
STM32 microcontrollers 32-bit microcontrollers that are based on ARM Cortex-M processors and manufactured by STMicroelectronics. This lecture gives a brief discussion about them.
This lecture introduces the SG90 servo motor. This device can be controlled using a PWM signal. At the end of this lecture, students will have an understanding of this servo motor as well as the peripheral of our microcontroller required to drive it.
In this lecture, students will learn how to create a Keil uVision project as well navigate through its Run-Time Environment (RTE). With an understanding of the RTE, CMSIS configurations required for a project can be made and necessary startup files will be included in the project. Also, with the RTE, students will be able to choose whether they'd use STM32CubeMx for code generation or not.
In this lecture, students will learn the following:
How to start the STM32CubeMx application from Keil uVision
How an STM32 timer's ARR register and prescaler work
STM32 timer configuration for PWM generation (using CubeMx) to control a servomotor
In this lecture, students will learn (or be introduced) the following:
Declaration and definition of a custom type for pin mapping (pinStruct_t)
Development of a class for the servomotor
The use of private and public keywords in a class
Passing variables by reference
What a constructor is and how to declare and implement one with respect to the servomotor
How to customize a CubeMx generated code (GPIO and Timer configurations) to create generic functions
HAL initialization
Use of extern "C"
In this lecture, students will learn the following:
How to modify CubeMx generated code
Relating some parts of CubeMx generated code with information from STM32 reference manual
Declaration and implementation of a member function of the Servo class to control the servo's position
Declaration and initialization of private variables
Creating a Servo object and statically allocating it
This lecture provides the source files and header files created during the development of the Servo motor library.
Continue building the hc-05 class by adding a get_char method that waits for rxne and reads the usart data register to fetch bluetooth data for debugging.
This lecture provides the source files and header files created during the development of the HC05 library.
This lecture provides the source files and header files created during the development of the Bluetooth-controlled servo application.
Send an enable pulse to the lcd enable pin to start data or instruction transfer and follow the 4-bit mode initialization with 15 ms, 5 ms, and 100 microseconds waits.
Design an lcd class that encapsulates data and exposes a simple print interface for characters, arrays, and integers, using abstraction and polymorphism.
Develop the lcd class constructor by configuring six microcontroller pins (rs, enable, d4, d5, d6, d7) as outputs, storing them in private variables, and preparing for the lcd initialization sequence.
Describe declaring and implementing an lcd constructor, initializing microcontroller pins, and executing the initialization sequence with power-on delay and nibble-wise, 4-bit mode setup.
In embedded software development using c++, this lecture adds a print method to the lcd class to display characters and arrays via polymorphic function overloading and pointer-based writes.
Initialize a display application with the lcd library, print a character and an array, configure six gpio c pins, and set the cursor to row three column two.
Demonstrates the LCD concepts covered in the previous lecture, using Embedded C++ within the course on embedded software development.
Advance the integer to string algorithm by extracting digits with modulus, converting digits to characters, and building a digits-plus-one output array, using 4582 as an example.
Implement a private method to convert an integer to a string in a zero-initialized buffer and transmit it to the lcd, enforcing a nine-digit display limit and zero-prefix alignment.
Overload the prints method for three integer sizes, each calling the private writes integer method on the lcd; ensure single-digit numbers display a leading zero for alignment via type promotion.
Demonstrates an LCD display integration in embedded software development using C++, building on content from the previous lecture.
Implement a clear screen method for the lcd class and demonstrate it by displaying hello world, delaying, clearing, then showing lovely google, delaying again, and printing the 8-bit value 7.
Demonstrate how an LCD module connects to an embedded system and review concepts from the previous lecture, highlighting practical setup and testing in C++.
This lecture provides the source files and header files created during the development of the LCD library.
Navigate the 4x4 keypad matrix, with rows as outputs and columns as inputs. Pressing a key like 4 connects row 2 to column 1, detectable via pull-up resistors.
Create a keypad class constructor for a 4x4 keypad using two pin arrays for rows and columns. Configure rows as outputs and columns as inputs with pull-ups via gpio APIs.
Implement a keypad long-press reader that scans the keypad matrix to return the corresponding character when a key is held, and returns null if no key is pressed.
Connect keypad to the microcontroller with row pins to pc6 and pa6 and column pins to the corresponding pins, then read keys using keypad get character long press.
Explore a keypad input demo using the gets character short press method, storing each pressed key in a 5-element array with modulo indexing and null termination, with debugging.
This lecture provides the source files and header files created during the development of the Keypad library (for the long keypress application demo).
This lecture provides the source files and header files created during the development of the Keypad library (for the short keypress application demo).
Watch a demo video on rules for embedded software development using C++, showcasing practical guidelines for coding in C++ within embedded contexts.
Watch a demo demonstrating how to start the game in embedded software development using C++.
Explore embedded software development using C++ through a sample gameplay scenario, illustrating how to design and implement efficient, reliable code for interactive applications.
This lecture provides the source files and header files created during the development of the Tic-tac-toe application. Students are expected to attempt developing their own application before going through these files.
Explore how the hcsr04 ultrasonic sensor measures distance using time of flight with a transmitter and receiver, and trigger and echo pins for reliable obstacle avoidance.
Develop a hcsr04 ultrasonic sensor class in c++, initialize trigger and echo pins via a constructor, configure pwm input mode with cube mx code, timer and gpio alternate function.
Implement the hcsr04 constructor to configure gpio and pwm input mode for timer channels 1 and 2, using stm32 cube mx and apply input capture filters to reduce noise.
This lecture provides the source files and header files created during the development of the HCSR04 library.
This video demonstrates a simple exercise students are expected to implement with knowledge gained from previous lectures.
The Embedded Software Development using C++ course demonstrates the application of object-oriented programming (OOP) in embedded systems. C++ is the language of choice because it has facilities that make OOP easy to implement and it also allows programming at the hardware level. As feature-rich and fantastic as C++ is, it is easy to misuse and this might cause code bloat. In this course, specific features of the language have been chosen to ensure the programs developed obey the following:
Simplicity
Readability
Maintainability
Core concepts of OOP such as abstraction, encapsulation and polymorphism are covered. The course aims to present this style of programming as simple and friendly as possible hence inheritance isn't covered. In order to make library and application development relatively faster, the STM32Cube HAL APIs are used and direct register-level programming is reduced to a minimum. The STM32F401RE Nucleo Board is used throughout this course and the Keil uVision5 MDK and STM32CubeIDE are used for software development and debugging. Since the course predominantly uses the HAL, then anyone taking the course can use a different STM32 microcontroller and run the same code (with few modifications) due to the portability of the HAL.
Most embedded software are written in C and with a procedural approach to programming. C++ isn't a replacement for C and neither is OOP a replacement for procedural programming. But C++ does provide some features that our embedded software can benefit from and if used judiciously, it would be rewarding for application development. In the end, it is a matter of preference and use case and this course ensures the applicability of the language and programming paradigm (OOP) are reflected and appreciated.
As a student of this course, you'd be exposed to the following:
Object-oriented programming on an embedded system and the following will be applied:
Classes, Encapsulation, Abstraction, Polymorphism
Private and Public keywords
Pointers and References
Type safety
Development of libraries using C++, STM32Cube HAL drivers and information from documentations to interface the STM32 microcontroller with external components like:
20x4 LCD
4x4 Keypad
SG90 Servo
HC05 Bluetooth Module
HC-SR04 Ultrasonic Sensor
L298N Motor Driver
Code generation using STM32CubeMx as well as modification and customization of the CubeMx generated code to suit the application being developed.
HAL GPIO, UART and Timer programming on the STM32
Use of timers for PWM signal generation as well as PWM input capture for determination of an input signal's duty cycle
Software design prior to the development of a library or application code
Code testing and debugging on Keil uVision 5 and STM32CubeIDE
As this course is project-based, students will build at least two projects, some of which include:
A Tic-tac-toe game console
An Autonomous car
I can guarantee that anyone that enrolls for this course will be able to build embedded software for projects with little to no supervision after completing this course. Also, as a graduate of this course, you'd be able to design and develop simple, readable and maintainable embedded software for several projects with well defined requirements using C++.
To get the best out of the course, students are required to purchase some hardware components and install some software in order to follow the lectures, exercises and projects with ease.
Software requirements:
Keil uVision5 MDK
Java runtime environment (required for the STM32CubeMx)
STM32CubeMx
STM32CubeIDE (for boards without HAL support in Keil uVision)
Students are also expected to be familiar with STM32 programming at a basic level i.e. understanding of basic peripherals and their registers (GPIO, UART and Timers in normal counting mode). Knowledge of embedded C would also be helpful. Either Keil uVision 5 or STM32CubeIDE can be used. For boards without HAL support in the Keil uVision toolchain (e.g. STM32 bluepill), STM32CubeIDE can be used.
The teaching and learning process in this course goes beyond the lectures and exercises. Students can always communicate with the instructor via the Q/A section. This section is very active as questions will be answered within 24 hours.