Mastering Microcontroller with Embedded Driver Development

Learn from Scratch Microcontroller & Peripheral Driver Development for GPIO,I2C,SPI,USART using Embedded C Programming
4.4 (162 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
1,173 students enrolled
Instructed by Kiran Nayak IT & Software / Hardware
70% off
Take This Course
  • Lectures 199
  • Length 9.5 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 7/2016 English

Course Description

>> Your Search for in-depth Microcontroller Programming Course ends here !!<<<

Course UP TO DATE as of November 2016! 

The course is designed for Beginners to Advanced audience. 

Brief Description 

This Course Demystifies the internal working of the Microcontroller and its Peripherals.

Coding for the Peripherals STEP-BY-STEP and Developing software drivers completely from scratch by extracting maximum information from Datasheets,Reference manuals, specs,etc

Protocol Decoding Using logic analyzers, Debugging, Testing along with Hints and Tips. 

Long Description:

Learning Embedded System Programming, can be a challenge. Since it's a relatively little complex field, there's no real gold standard yet for how things are practiced, or taught, which can frustrate people who are just trying to learn new things and couldn’t able to connect the dots and this is the motivation behind creating this course to help engineers and students to learn different aspects of embedded systems by providing high quality advanced lectures with relatively low price.

Learn at your own pace using progressive method, with each of my short, info-packed lectures.

Master Behind the Scene working !
I created this course because I believe your time is precious, and you shouldn't have to hunt around to get a practical foundation In Embedded System Programming. In this course, you are going to learn writing your own peripheral driver for most of the commonly used peripherals such as GPIOs, I2C, SPI, USART, etc. and interesting thing is that you are going to learn everything from scratch.

No 3rd party libraries !

No blind coding !

Write your own Driver APIs by dealing with the Peripheral Registers of the MCU !

Code and Implement APIs from scratch , diving into the datasheet and reference manual of the MCU. I will thoroughly explain how to extract the maximum information from datasheets, Technical Reference manuals to configure and handle peripherals. These techniques you can go and apply to any MCUs you have at your hand.

In this course I will walk you through step by step procedure how to Configure various Peripherals like GPIOs,SPI,USART,I2C by taking you into the reference manual and data sheet. We will develop fully working driver code, interrupt handlers, sample application everything from scratch to understand the big picture.

In each lecture, I assure you that, you will definitely learn something new that you can definitely use in your work or projects. You'll find yourself handling these peripherals with much more clarity and you will be able to quickly speculate and debug the problem and I’ll show you tricks and tips to debug the most common problems  using debugging tools such as logic analyzers. 

This is not Arduino Style of programming!

I believe Arduino is for quick prototyping of products but not for Mastering Working of microcontrollers and its peripherals. Unlike Arduino programming where you come up with quick solution and prototyping of products using third party libraries, this course is entirely different. In this course no 3rd party libraries is used. Everything we will code by referring to the Technical reference manual of the MCU and create our own library. The Power of this approach is when things go wrong in your project work due to bugs, you can quickly able to speculate problem and debug like a pro. If one thing me and my students are good at is "debugging". To achieve good debugging skills its very important you code by understanding how things works behind the scene but no by just blindly using some third party libraries and that’s the biggest TAKE away from this Course.

The course is designed and explained in such a way that, it is  generic across any kind of microcontroller. The code we develop can be used as templates to quickly come with peripheral driver for your MCUs on chip peripherals.

Software/Hardware used:
In this course, the code is developed such a way that, It can be ported to any MCU you have at your hand. If you need any help in porting these codes to different MCUs you can always reach out to me! The course is strictly not bound to any 1 type of MCU. So, if you already have any Development board which runs with ARM-Cortex M3/M4 processor, then I recommend you to continue using it. But if you don’t have any Development board, then checkout the below Development boards.

1.    STM32F407xx based Discovery board ( This is the board used in this course )

MCU Vendor : STMicroelectronics

2.    STM32 Nucleo-64 development board( New in the market )

MCU Vendor : STMicroelectronic

3.    FRDM-K64F: Freedom Development Platform

MCU Vendor : NXP

4.    STM32F429IDISCOVERY with LCD

MCU Vendor :  STMicroelectronics

My promise !
I am confident that this course will save you many, many hours of studying/experimenting/googling  time to learn about Programming the MCU. I will personally answer your questions about this material, either privately or in a group discussion.  If you are in any way not satisfied, for any reason, you can get a full refund from Udemy within 30 days. No questions asked. But I am confident you won't need to. I stand behind this course 100% and am committed to helping you . 

What are the requirements?

  • Basic knowledge of C and Micro controller could be added advantage but not mandatory

What am I going to get from this course?

  • Understand Right ways of Handling and programming MCU Peripherals
  • Develop Peripheral drivers for your Microcontroller
  • Understand complete Driver Development steps right from scratch for GPIO,SPI,I2C and USART.
  • Learn Writing peripheral driver headers, prototyping APIs and implementation
  • Explore MCU data sheets, Reference manuals, start-up Codes to get things done
  • Learn Right ways of handling/configuring Interrupts for various peripherals
  • Learn about Peripheral IRQs/Vector table/NVIC interfaces and many
  • Learn about Configuration/status/Control registers of various Peripherals
  • Demystifying behind the scene working details of SPI,I2C,GPIOs,USART etc.
  • Explore hidden secretes of MCU bus interfaces, clock sources, MCU clock configurations, etc.
  • Understand right ways of enabling/configuring peripheral clocks/serial clocks/baud rates of various serial protocols
  • Learn about MCUs AHB, APB bus protocols
  • Learn about different MCU clocks like HCLK, PCLK, PLL,etc
  • Learn to capture/decode/analyze traces of serial protocols on Logic analyzer
  • Learn about Quick ways of debugging peripheral issues with case studies

Who is the target audience?

  • Professionals interested in exploring Embedded systems
  • Hobbyists and students who want to start their career in Embedded world
  • If you think about 'embedded' then think about taking this course. you will not be disappointe
  • This Course may not be suitable for those people who are looking for quick prototyping using boards such as Arduino

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Overview of the Course

This lecture gives complete overview about the course !

Watch this full, before deciding to take this course .. It is available for free preview 

Section 2: GPIO Must know concepts

A quick explanation about GPIO pin and GPIO Port of a Microcontroller to get started. 


Ahh. This is a very important lecture, where You will come to know, whats the behind the scene implementation of an I/O pin in the MCU. Understanding behind the scene implementation is very important to know how GPIOs actually behave. 

you will also come know I/O input and output mode, input and output mode buffers associated with an I/O pin which gets activated as per the mode selection 


In this Lecture I will explain about GPIO input mode with HI-Z or high impedance state configuration .

you will understand , what exactly HI-Z state is !


In this lecture, You will understand GPIO input mode with pull up or pull down state. 

you will come to know about pull up and pull down resistors and whats their importance. 


This is a very important lecture where you will come to know, what exactly is open drain state, What is its advantages , How to use open drain configuration in a practical scenarios like Driving LEDs or I2C bus implementation. 

I will also show you , how to make use of open drain output mods by using internal or external pull-up resistors. 


In this lecture you will come to know GPIO output mode with push pull configuraion. 

I will talk about push pull configuration in detail and some practical use cases like driving LEDs from push pull state. 


if you ever heard that by keeping pin floating you may be wasting power through I/Os, In this lecture lets see 

how current gets leaked out through I/O pin during different configurations and how to solve it 

Section 3: GPIO Programming structure and Registers

In this lecture, in general i will talk about typical gpio programming structure in a Microcontroller. 


Lets see how many GPIO ports our MCU supports and How many ports are brought out on the development board. 


In this lecture lets explore about one of the most common and must use GPIO register , that is GPIO MODE selection register. I will walk you through  this register by taking you to the technical reference manual of the MCU. 


In this lecture lets explore about  GPIO Output Type register which is used to select the output type for an I/O pin. I will walk you through  this register by taking you to the technical reference manual of the MCU.


In this lecture you will come know the significance of GPIO speed register which controls the I/O transition .

All modern day MCUs has this register to control the speed parameter . 


Do you know most of the I/Os has their own internal pull-up and pull-down resistors, which you can activate by configuring the configuration register. 

This lecture discusses about that register


In this lecture I will talk about the GPIO port input Data register and its usage.


In this lecture I will talk about the GPIO port Output Data register and its usage.


Do you know, every peripheral in the MCU needs clock to operate and it is called peripheral clock . ?

and Do you also know that, in MCU by default peripheral clocks for all most all peripherals are disabled to save power. ?

In this lecture , I will show you how to enable and disable the GPIO peripheral clock .

We will also explore the MCUs clock registers to configure the clock for different GPIO ports. 


This is very important lecture, where I will discuss how to configure an I/O pin for different alternate functionalities like I2C, SPI,UART,etc. 

Configuring alternate functionality register is must when you wan to use I/O pin for I2C,SPI,USART communication.  

Find Out I/O Alt Functionality
1 question
Section 4: GPIO Driver Development: Lab Setup
Hardware/Software Requirements

In this lecture I will walk you through installing newer KEIL-MDK-5 software. 


In this lecture I will walk you through installing software packs on top of KEL-MDK-5 software. 

Software packs are very important and needs to be installed for your MCU using pack installer of the KEIL Micro vision IDE


Lets get started with KEIL-micro vision IDE by creating a simple project for your target. 

I will also explain what are the target specific configurations you need to do in order to flash the code successfully on to your board. 


In this lecture you will come know, some debugging options available in the KEIL-Micro vision IDE. like

single stepping 

memory window 

watch functionality 

setting/clearing breakpoints

disassembly window 



In this lecture lets quickly explore the STM32F407 discovery board and its parts. 

Section 5: GPIO Driver Development: Getting started

In this lecture lets explore the overview of our driver development task . 

This helps to understand the big picture of what we are going to accomplish in the subsequent sections 


In this lecture , lets decide various APIs , which needs to supported by our GPIO driver. 

Section 6: GPIO Driver Development: Explore MCU specific header file

This lecture will explain how to organise files in KEIL project which helps you to handle more complex project where various source files and header files are involved . 


MCU specific header files are very important to be aware of , because it contains various information like MCU memory map, Peripheral register structure, IRQs, register bit definitions,etc. 

Each MCU will have its own MCU specific header file. 

In this lecture lets, locate where all the MCU specific header files are located in you PC as a part of software pack 



In this lecture, I will walk you through some of the important information of the MCU specific header file like Memory map, Peripheral register structure , base addresses of various peripherals , etc. 

Explain __IO
1 question
Section 7: GPIO Driver Development : Driver header file

Before writing driver source file, its very important to write the driver header file which must have the following information

1) Peripheral register bit definition macros 

2) Peripheral Private data structure 

3) Driver API prototype 

4) other helper macros . 

in this lecture lets fill up our driver header file with all the above details. 

Section 8: GPIO Driver Development: Implementing Init API

This lecture implements helper function to configure the I/O mode 


In this lecture, you will code a helper function to configure the I/O speed and output type


In this lecture, you will code a helper function to configure the I/O Pull-up/pull-down capability 


In this lecture, you will code a helper function to configure the I/O alternate functionality . 

Embedded Coding Skill
1 question
Section 9: GPIO Driver Development: Implementing Read/Write APIs

In this lecture you will implement the GPIO Read API of the GPIO driver


In this lecture you will implement the GPIO Write API of the GPIO driver

Section 10: GPIO driver Code testing:Writing Sample APP

From this lecture, lets start implementing the Sample APP to test our GPIO driver code,

First will will write a init function to configure the on board LEDs by using driver exposed APIs


Lets write separate Turn on/Turn off/Toggle LED functions by using our driver exposed APIs


In this lecture, Lets see how we can test the whole implementation(driver + sample app) on the target board. 

we will  build , flash  and run on to the target board . 


Lets get the trace on the USB logic analyzer and see how it looks toggling the LEDs

You must see a beautiful square wave on the logic analyzer. 

In this lecture lets learn how to achieve that. 

I will teach you , how to configure, connect and capture the trace. you will indeed like it 

Section 11: GPIO Interrupt Handling

Now something serious, 

How external interrupt mechanism works in ARM Cortex M3/M4 or for any processor ?

It is not that difficult to understand interrupts . 

In this lecture and lectures to follow , I will demystify the working of external interrupts. 

You will learn almost everything you need to know about interrupt .

You can go and apply this lecture to any MCU you have at your hand . 


In this lecture you will understand , What is "IRQ" number of an interrupt 

I will guide you through technical reference manual how to find out IRQ number of external interrupts. 


In this lecture lets understand about "Vector Table" to decode vector addresses and to see how ISR gets called by the information hidden in the vector table, again we will go the reference manual of the MCU to explore the vector table. 

Also i will show you , how the MCU startup code takes care of initializing the vector table. This also helps if you ever wants to implement your own Startup code for the MCU. 

Also in this lecture , lets see IRQ handles of different peripherals as defined in the startup code 


Lets give the interrupt handling capability to our driver by adding interrupt handling APIs 

We will add 3 APIs 

1) To configure the interrupt on a given GPIO pin 

2) To Enable the interrupt 

4) To clear the interrupt which is set


In this lecture lets implement APIs to configure and enable the interrupt on GPIO


You must clear the interrupt once it is set, otherwise the NVIC of the processor will keep getting kicked 

and you may get the infinite interrupt . 

In this lecture we will see how to solve this issue 


Finally after adding interrupt handling capability to our driver, lets test our driver using a on board Button. 

Find out IRQ number
1 question
Interrupt Pending Bit
1 question
Section 12: SPI Essentials (All about SPI)

In this section, I will give you a quick introduction to the SPI Protocol and bus


In this section we will understand the overview of how SPI protocol works 

Master and slave communication details, Pin details, and many

Also with waveform, i will explain the basic protocol involved in SPI communication between Master and Slave.


This is a important lecture , where I will show you how SPI engine works behind the scenes. 

We will explore the hardware block involved in the SPI communication and how they exchange the data 

with reference to the clock signal. 

Section 13: What is phase , polarity and SPI modes ?

SPI protocol depends upon polarity and phase. 

In this lecture, I will walk you through step by step procedure to understand SPI Polarity and SPI phase. 

This will surely enhance your grip on understanding SPI Protocol


Depending upon the value of SPI phase and Polarity , there are various modes of the SPI Protocol. 

In this lecture with Timing diagram, I will explain SPI_MODE_0, SPI_MODE_1, SPI_MODE_2, SPI_MODE_3

you will come to know, how the sampling and data toggling changes in the SPI communication with respect to SPI modes. 

We will have separate timing diagram to each mode to discuss the effect of changing SPI mode


In this section, I will walk you through understanding Uni-Directional and Bi-Directional SPI supported by most of the MCUs. 

To save pins of the MCU , its very important to understand how Bi-Directional SPI works and what are the other different SPI implementations are available. 

Section 14: SPI: Functional Block and Clock

In this section , lets understand the functional block of the SPI engine inside the Microcontroller. 

Understanding functional block gives clarity when code for the peripheral. The functional block of SPI engine is almost same across different Microcontroller. So understanding functional block give a good overview about the inner working of the peripheral. 


Every Peripheral needs Peripheral clock to operate and SPI derives its serial line clock from the Peripheral clock. 

In this lecture lets understand how to configure the peripheral clock (Fpclk) for the different SPI peripheral and how to derive the serial line clock for the SPI communication. 

we will understand the big picture of deriving the serial line clock(sclk) from the peripheral clock of the SPI

Find out SPI Max Speed
1 question
Section 15: SPI Important Registers

The control registers are the one which govern the operation of the SPI Peripheral. 

Its very important to know about SPI control register to handle the peripheral properly and it also helps in debugging when issues arise. 

So, in this lecture lets explore about the SPI control register bit by bit 


The data register is used to hold the data which needs to be transmitted over SPI bus. 

In this lecture lets explore about the SPI data register and its features if any !


All the events that are generated during SPI communication will be recorded by the status bits in the status register. 

so, its very important to know about the SPI status register in order to handle those events in firmware properly. 

in this lecture lets explore about the SPI status register bit by bit 

Section 16: SPI Driver Development: Getting started

In this lecture lets see the overview of our "SPI driver development task"


In this lecture lets discuss about the APIs which needs to be implementation as a part of SPI driver implementation. 


The MCU has many number of SPI peripherals. In this lecture lets discuss about different SPI peripheral and its associated pin packs . Also we will see to what bus they are hooked up inside the MCU. 

Section 17: SPI Driver Development : Writing Driver header file

In this lecture lets convert the SPI register details in to the  'C' Macros . We will write all the register bit definition macros in the SPI driver header file. 


In this lecture , lets explore the 'C' Structure used to handle the SPI Peripheral. This structure will have all the details which helps to handle the peripheral. The application can fill this structure and pass it to handle during initialization 

Lets explore these structure and its member elements one by one !


In this lecture lets write the driver exposed API Prototypes in the header file. 

Section 18: SPI Driver Development: Implementing init API

In this lecture, Lets start coding . 

First we will write the Init API which does essential SPI peripheral initialization . 

There are many initialization needs to be done before using the SPI peripheral. 

We will write separate micro helper function to achieve each single initialization . 


In this lecture, lets code the helper function to configure SPI mode, SPI phase and SPI polarity.


In this lecture, lets code the helper function to configure SPI datasize, baudrate and direction !


In this lecture, lets code the helper function to configure NSS, which is slave select pin. 

I will also explain in detail, what is software slave management and hardware slave management 

and when to use them. 


In this lecture, lets code the helper function to configure Enabling and Disabling SPI Peripheral . 

Section 19: SPI Driver Development: Implementing TX/RX API

In this lecture, lets code the API to implement the SPI master TX API . 

This function will be no blocking , that means , we will implement TXing using SPI interrupt 


In this lecture, lets code the API to implement the SPI master RX API . 

This function will be non blocking , that means , we will implement RXing using SPI interrupt 

This also helps you to understand SPI interrupt handling 


In this lecture, lets code the API to implement the SPI slave TX API . 

Again non-blocking or interrupt driven Txing


In this lecture, lets code the API to implement the SPI slave RX API . non-blocking or interrupt driven TRxing

Section 20: SPI Master/Slave Communication

Now after understanding spi engine, its control/status/data register and many more information, in this lecture lets 

understand how we can use all these information to understand how exactly SPI master does Txing or Rxing of data in STM32F4xx based device. 

I will thoroughly discuss various status levels of different flags during the will also come to know what are the important flash which gets affected and how to use them to achieve successful Rxing or Txing of data 

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Kiran Nayak, Firmware Engineer, FastBit Embedded Brain Academy

Kiran Nayak holds the Designation of Embedded Software Developer and has over 8+  years of experience in domain Embedded Software Development, Firmware Engineering, Real time systems, etc. He worked with some of the leading chip manufacturing companies in the domain of firmware engineering, BLE SDK development, Low power wireless protocol stack development, etc. 

He is with udemy for more than a year and has produced 3 courses on ARM Cortex M processor programming, Microcontroller programming by scratch and also on Real Time Operating systems. 

He is a frequent presenter in Conferences and seminars. He obtained his bachelor’s Degree in Electronics and Communication engineering and Co-authored and presented Many IEEE papers in different International conferences. 

Ready to start learning?
Take This Course