{"id":11738,"date":"2022-09-17T08:34:58","date_gmt":"2022-09-17T08:34:58","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=11738"},"modified":"2023-09-28T15:41:09","modified_gmt":"2023-09-28T10:11:09","slug":"microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/","title":{"rendered":"Microcontroller Embedded C Programming Lecture 108| Memory mapped peripheral registers  and IO access"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-color: #f7f6f6; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<div class=\"boldgrid-shortcode\" data-imhwpb-draggable=\"true\">\n\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 35px; border-width: 0px; line-height: 45px;\"><strong><span style=\"color: #000080;\"><b>Memory mapped peripheral registers&nbsp; and IO access<\/b><\/span><\/strong><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">This article delves into the concept of peripheral registers and how they are used in STM32 microcontrollers.<\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; line-height: 35px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><b>About peripheral registers<\/b><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">All peripheral registers in STM32 microcontroller are of 32 bits wide.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Different peripherals have different number of peripheral registers.<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, a GPIO peripheral may have 10 registers, ADC may have 15, and I2C may have 20, so that depends upon the complexity of the peripheral.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Simple peripheral may have less number of peripheral registers. A complex peripheral like Timer, or Ethernet, MAC, CAN have more number of registers.&nbsp;<\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">You should never assume about the address of the peripheral registers. Always you should refer to the device reference manual.<\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_11741\" aria-describedby=\"caption-attachment-11741\" style=\"width: 520px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-11741\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/09\/Figure-1-11-1024x496.png\" alt=\"Memory mapped peripheral registers and IO access\" width=\"520\" height=\"252\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-1024x496.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-300x145.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-768x372.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-600x291.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-1536x744.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-200x97.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-400x194.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-800x388.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11-1200x581.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-1-11.png 1703w\" sizes=\"(max-width: 520px) 100vw, 520px\" \/><figcaption id=\"caption-attachment-11741\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. GPIOD Peripheral registers<\/span><\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">These are the peripheral registers of GPIOD peripheral(Figure 1).<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">GPIOA, GPIOB, and GPIOC also have the same set of registers, but I&#8217;m considering GPIOD because we&#8217;ll be working on GPIOD peripherals.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">GPIOD peripherals has up to 10 registers, as shown in Figure 1. Each register is 32 bits.<\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"text-decoration: underline; color: #d94316;\"><b>GPIOD port mode register:<\/b><\/span> <span style=\"font-weight: 400;\">It is used to control the mode of an IO pin, whether you want to drive that IO pin as an input or output.<\/span><\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, if you are driving an LED, then you probably configuring the mode of an IO pin as output. If you are using an IO pin to connect a button, in that case, you probably want to configure the IO pin as an input. So, for all those configurations you do use the mode register of the GPIO port.<\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"text-decoration: underline; color: #d94316;\"><b>GPIOD port output type register<\/b><span style=\"font-weight: 400;\">:<\/span><\/span> <span style=\"font-weight: 400;\">It decides what should be the output type of an IO pin if it is in output mode.<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"text-decoration: underline; color: #d94316;\"><b>GPIOD port pull-up\/pull-down register:<\/b><\/span><span style=\"font-weight: 400;\"> It is one important register to activate or deactivate the internal pull-up resistors for the IO pins.<\/span><\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"text-decoration: underline; color: #d94316;\"><b>GPIOD port input data register:<\/b><\/span><span style=\"font-weight: 400;\"> If you want to read data from the IO pins, then you probably would be using an input data register. So, this is used to read data from the IO pins.<\/span><\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"text-decoration: underline; color: #d94316;\"><b>GPIOD port output data register:<\/b> <\/span><span style=\"font-weight: 400;\">It is used to write data into the IO pins.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">So, to turn on or turn off an LED you probably use an output data register. Because through the output data register we actually write data into the IO pins.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And there are other registers that we will not be using for this exercise, so that&#8217;s why we need not explore all registers.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For this exercise, we should be using the mode register and output data register. The mode register is to configure the mode and the output data register is to configure write data.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, if you want to turn on the LED, then you have to write 1 into the output data register.&nbsp; If you want to turn off the LED, then you have to write 0. So, we&#8217;ll see that when we do programming.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_11742\" aria-describedby=\"caption-attachment-11742\" style=\"width: 602px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-11742\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/09\/Figure-2-9-1024x565.png\" alt=\"Memory mapped peripheral registers and IO access\" width=\"602\" height=\"332\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-1024x565.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-300x165.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-768x424.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-600x331.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-1536x847.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-200x110.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-400x221.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-800x441.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9-1200x662.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9.png 1775w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><figcaption id=\"caption-attachment-11742\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. GPIOD peripheral and it\u2019s registers<\/span><\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">These are the register sets of the GPIOD peripheral. All these registers everything is implemented inside the microcontroller.&nbsp;<\/span><\/p>\n<div class=\"row bg-editor-hr-wrap\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<hr>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"font-size: 20px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><strong>Register Arrangement<\/strong><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s see how they are arranged.<\/span><\/p>\n<figure id=\"attachment_11743\" aria-describedby=\"caption-attachment-11743\" style=\"width: 584px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-11743\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/09\/Figure-3-7-1024x581.png\" alt=\"Memory mapped peripheral registers and IO access\" width=\"584\" height=\"332\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7-1024x581.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7-300x170.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7-768x436.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7-600x340.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7-400x227.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7-800x454.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7-1200x681.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-3-7.png 1447w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><figcaption id=\"caption-attachment-11743\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. GPIOD port MODE register<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, the first register you find in the address range of GPIOD peripheral registers is the GPIOD&nbsp; mode register. That&#8217;s the very first register you find at the address 0x4002_0C00. As I said each register is of 32 bits. That&#8217;s why, GPIOD port MODE register consumes these many memory locations, as shown in Figure 3. 0x4002_0C00 to 0x4002_0C03 which is 32-bit width.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The GPIOD port output type register is the next register, which starts from 0x4002_0C04 at this address onwards. <\/span><\/p>\n<figure id=\"attachment_11744\" aria-describedby=\"caption-attachment-11744\" style=\"width: 521px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-11744\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/09\/Figure-4-6-1024x582.png\" alt=\"Memory mapped peripheral registers and IO access\" width=\"521\" height=\"296\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6-1024x582.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6-300x171.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6-768x437.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6-600x341.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6-200x114.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6-400x227.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6-800x455.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6-1200x682.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-4-6.png 1419w\" sizes=\"(max-width: 521px) 100vw, 521px\" \/><figcaption id=\"caption-attachment-11744\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. GPIOD port OUTPUT TYPE register<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_11745\" aria-describedby=\"caption-attachment-11745\" style=\"width: 556px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-11745\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/09\/Figure-5-3-1024x536.png\" alt=\"register memory\" width=\"556\" height=\"291\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-1024x536.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-300x157.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-768x402.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-600x314.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-1536x804.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-200x105.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-400x209.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-800x419.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3-1200x628.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-5-3.png 1877w\" sizes=\"(max-width: 556px) 100vw, 556px\" \/><figcaption id=\"caption-attachment-11745\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. GPIOD Peripheral registers<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">GPIOD peripheral has 10 registers and 0x4002_0C00, 0x4002_0C04, 0x4002_0C08, 0x4002_0C0C, 0x4002_0C24 these are the addresses of the individual registers.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">0x4002_0C00 is the address of the mode register, 0x4002_0C04 is the address of the output type register, like that.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">So, if you just add +4 to the address, you get the address of the next register.<\/span><\/p>\n<div class=\"row bg-editor-hr-wrap\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<hr>\n<\/div>\n<\/div>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 23px; border-width: 0px; line-height: 33px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #ff0000;\"><b>How do you control the output state of the GPIO pin?<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You must be using the GPIOD output data register because through the output data register we send data to the IO pins.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, you can easily calculate the address of the GPIOD Output data register. so you already know how to calculate that.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The 0th-bit position of this register controls the 0th pin of the GPIOD port. So, the 0th-bit field controls PD0. If you make 0th bit field as high that is 1,&nbsp; then that makes the state of the PD0 as high, that means PD0 will be pulled to +VCC, as shown in Figure 6. So, that is actually 3.3 volts.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">If you make this bit field 0, then PD0 will be pulled to the ground, it is like driven to ground 0 volts.<\/span><\/p>\n<figure id=\"attachment_11746\" aria-describedby=\"caption-attachment-11746\" style=\"width: 594px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-11746\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/09\/Figure-6-4-1024x544.png\" alt=\"Figure 6. Control the Output state of the GPIO pin\" width=\"594\" height=\"315\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-1024x544.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-768x408.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-1536x816.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-800x425.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4-1200x638.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-6-4.png 1887w\" sizes=\"(max-width: 594px) 100vw, 594px\" \/><figcaption id=\"caption-attachment-11746\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. Control the Output state of the GPIO pin<\/span><\/figcaption><\/figure>\n<div class=\"row bg-editor-hr-wrap\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<hr>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 23px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 33px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #ff0000;\"><b>How do you control the PD12 where our LED is connected?<\/b><\/span><\/p>\n<figure id=\"attachment_11747\" aria-describedby=\"caption-attachment-11747\" style=\"width: 517px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-11747\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/09\/Figure-7-2-1024x549.png\" alt=\"Figure 7. Control the PD12\" width=\"517\" height=\"277\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-1024x549.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-300x161.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-768x412.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-600x322.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-1536x824.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-200x107.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-400x215.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-800x429.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2-1200x644.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-7-2.png 1751w\" sizes=\"(max-width: 517px) 100vw, 517px\" \/><figcaption id=\"caption-attachment-11747\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. Control the PD12<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 29px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You should be touching the 12th bit of this GPIOD register. If you want to turn on the LED make the 12th-bit position as 1, so if you want to turn off the LED make the 12th-bit position of this register as 0. That&#8217;s all you have to do.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the following lecture, let&#8217;s understand the <a href=\"http:\/\/fastbitlab.com\/microcontroller-embedded-c-programming-c-lecture-109-procedure-to-turn-on-the-led\/\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline; color: #ff6600;\">procedure to turn on the LED<\/span><\/a>.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><strong><span style=\"color: #993366;\">Get the Full Course on Microcontroller Embedded C Programming<\/span> <\/strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.udemy.com\/course\/microcontroller-embedded-c-programming\/\">Here<\/a><\/span>.<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 21px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\"><span style=\"color: #000000;\">lick here:<\/span>&nbsp;<\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Memory mapped peripheral registers&nbsp; and IO access &nbsp; &nbsp; This article delves into the concept of peripheral registers and how they are used in STM32 microcontrollers. &nbsp; About peripheral registers All peripheral registers in STM32 microcontroller are of 32 bits wide.&nbsp; Different peripherals have different number of peripheral registers. For example, a GPIO peripheral [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11742,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[16],"class_list":["post-11738","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-microcontroller-embedded-c-programming","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Memory Mapped Peripheral Registers and I\/O Access in STM32 Microcontroller<\/title>\n<meta name=\"description\" content=\"Memory mapped peripheral registers and IO access. Dive into the world of memory-mapped peripheral register in STM32 microcontrollers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Memory Mapped Peripheral Registers and I\/O Access in STM32 Microcontroller\" \/>\n<meta property=\"og:description\" content=\"Memory mapped peripheral registers and IO access. Dive into the world of memory-mapped peripheral register in STM32 microcontrollers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-17T08:34:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-28T10:11:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1775\" \/>\n\t<meta property=\"og:image:height\" content=\"979\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"Microcontroller Embedded C Programming Lecture 108| Memory mapped peripheral registers and IO access\",\"datePublished\":\"2022-09-17T08:34:58+00:00\",\"dateModified\":\"2023-09-28T10:11:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/\"},\"wordCount\":1012,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Figure-2-9.png\",\"keywords\":[\"Microcontroller Embedded C programming Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/\",\"name\":\"Memory Mapped Peripheral Registers and I\\\/O Access in STM32 Microcontroller\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Figure-2-9.png\",\"datePublished\":\"2022-09-17T08:34:58+00:00\",\"dateModified\":\"2023-09-28T10:11:09+00:00\",\"description\":\"Memory mapped peripheral registers and IO access. Dive into the world of memory-mapped peripheral register in STM32 microcontrollers.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Figure-2-9.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Figure-2-9.png\",\"width\":1775,\"height\":979,\"caption\":\"Figure 2. GPIOD peripheral and it\u2019s registers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microcontroller Embedded C Programming Lecture 108| Memory mapped peripheral registers and IO access\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Memory Mapped Peripheral Registers and I\/O Access in STM32 Microcontroller","description":"Memory mapped peripheral registers and IO access. Dive into the world of memory-mapped peripheral register in STM32 microcontrollers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/","og_locale":"en_US","og_type":"article","og_title":"Memory Mapped Peripheral Registers and I\/O Access in STM32 Microcontroller","og_description":"Memory mapped peripheral registers and IO access. Dive into the world of memory-mapped peripheral register in STM32 microcontrollers.","og_url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-09-17T08:34:58+00:00","article_modified_time":"2023-09-28T10:11:09+00:00","og_image":[{"width":1775,"height":979,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"Microcontroller Embedded C Programming Lecture 108| Memory mapped peripheral registers and IO access","datePublished":"2022-09-17T08:34:58+00:00","dateModified":"2023-09-28T10:11:09+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/"},"wordCount":1012,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9.png","keywords":["Microcontroller Embedded C programming Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/","url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/","name":"Memory Mapped Peripheral Registers and I\/O Access in STM32 Microcontroller","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9.png","datePublished":"2022-09-17T08:34:58+00:00","dateModified":"2023-09-28T10:11:09+00:00","description":"Memory mapped peripheral registers and IO access. Dive into the world of memory-mapped peripheral register in STM32 microcontrollers.","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/09\/Figure-2-9.png","width":1775,"height":979,"caption":"Figure 2. GPIOD peripheral and it\u2019s registers"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-108-memory-mapped-peripheral-registers-and-io-access\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microcontroller Embedded C Programming Lecture 108| Memory mapped peripheral registers and IO access"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/11738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=11738"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/11738\/revisions"}],"predecessor-version":[{"id":16077,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/11738\/revisions\/16077"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/11742"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=11738"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=11738"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=11738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}