
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.
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.
This lecture provides the source files and header files created during the development of the LCD library.
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).
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.
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.