{"id":4583,"date":"2020-06-19T12:08:29","date_gmt":"2020-06-19T10:08:29","guid":{"rendered":"https:\/\/deepbluembedded.com\/?p=4583"},"modified":"2025-02-17T15:00:54","modified_gmt":"2025-02-17T13:00:54","slug":"stm32-timer-interrupt-hal-example-timer-mode-lab","status":"publish","type":"post","link":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/","title":{"rendered":"STM32 Timer Interrupt HAL Example &#8211; Timer Mode LAB"},"content":{"rendered":"\n<p class=\"has-text-align-justify\">In this tutorial, we&#8217;ll discuss how to configure the STM32 timer module to generate timer interrupts with a couple of example projects (Timer Mode). You&#8217;ll go through step-by-step HAL example configurations to initialize all the required hardware peripherals. Then, we&#8217;ll write simple application code to test the hardware functionalities. And also we&#8217;ll see how to calculate the timer preload value to get the desired output time interval exactly. without further ado, let&#8217;s get started!<\/p>\n\n\n<h2 class=\"simpletoc-title\">Table of Contents<\/h2>\n<ol class=\"simpletoc-list\">\n<li><a href=\"#stm32-timer-calculation-amp-equation-formula\">STM32 Timer Calculation &amp; Equation Formula<\/a>\n\n<\/li>\n<li><a href=\"#stm32-timer-interrupt-example-lab\">STM32 Timer Interrupt Example (LAB)<\/a>\n\n<\/li>\n<li><a href=\"#stm32-timer-interrupt-example-project-steps\">STM32 Timer Interrupt Example Project (Steps)<\/a>\n\n<\/li>\n<li><a href=\"#stm32-timer-interrupt-example-code-in-cubemx-ide\">STM32 Timer Interrupt Example Code in CubeMX IDE<\/a>\n\n<\/li>\n<li><a href=\"#testing-the-stm32-timer-example-project\">Testing The STM32 Timer Example Project<\/a>\n\n\n<li><a href=\"#stm32-timer-finetiming-experiment\">STM32 Timer Fine-Timing Experiment<\/a>\n\n<\/li>\n<li><a href=\"#using-stm32-timer-interrupt-calculator\">Using STM32 Timer Interrupt Calculator<\/a>\n\n<\/li>\n<li><a href=\"#wrap-up\">Wrap Up<\/a>\n<\/li><\/ol>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-ba57796c gb-headline-text\" id=\"stm32-timer-calculation-amp-equation-formula\"><strong>STM32 Timer Calculation &amp; Equation Formula<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">In this LAB, we&#8217;ll set up a general-purpose timer module to operate in timer mode. We&#8217;ll set the overflow time interval to the desired value using the equation below. And toggle an LED in the interrupt service routine (ISR) for the timer overflow event.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"221\" height=\"41\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-Interrupt-Equation.png\" alt=\"\" class=\"wp-image-11381\"\/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">As you can see, the output time interval is determined by the Prescaler value, the clock frequency, and the timer auto-reload register&#8217;s value. Given that the blue pill board can run @ up to 72MHz, so let&#8217;s set the frequency to 72Mz. Now, we can choose a value for the Prescaler then put in the desired T<sub>OUT<\/sub> and solve for the auto-reload register&#8217;s value.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">In LAB7, we&#8217;ll set our desired output time interval to be 100ms. We&#8217;ll toggle the LED once each 100ms and we&#8217;d like to set up the timer interrupt to give us this time interval. So, from the above equation, we can set the F<sub>CLK<\/sub> to be 72MHz. And let the Prescaler be <strong>999<\/strong>. Now, the only unknown is the auto-reload (ARR) value. By solving for it, we&#8217;ll get <strong>7199<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"212\" height=\"38\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-Interrupt-Example-Calculation.png\" alt=\"\" class=\"wp-image-11383\"\/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-70accfbf gb-headline-text\" id=\"stm32-timer-interrupt-example-lab\"><strong>STM32 Timer Interrupt Example (LAB)<\/strong><\/h2>\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\"><strong>LAB Number<\/strong><\/span><\/td><td><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">7<\/span><\/td><\/tr><tr><td><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\"><strong>LAB Title<\/strong><\/span><\/td><td><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Timer Mode Periodic Event<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Configure the general-purpose timer (TIM2) to operate in timer mode<\/span><\/li>\n\n\n\n<li><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Set The Prescaler, and the Preload value so that the output Time interval is 100ms<\/span><\/li>\n\n\n\n<li><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Toggle an output pin (LED) each 100ms in the timer overflow ISR<\/span><\/li>\n\n\n\n<li><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Measure and verify the output signal&#8217;s timing<\/span><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-9d390c84 gb-headline-text\" id=\"stm32-timer-interrupt-example-project-steps\"><strong>STM32 Timer Interrupt Example Project (Steps)<\/strong><\/h2>\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step1<\/span>: Open CubeMX &amp; Create New Project<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1014\" height=\"618\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Create-New-Project.png\" alt=\"STM32 CubeMX Create New Project\" class=\"wp-image-4293\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Create-New-Project.png 1014w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Create-New-Project-300x183.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Create-New-Project-768x468.png 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Create-New-Project-600x366.png 600w\" sizes=\"auto, (max-width: 1014px) 100vw, 1014px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step2<\/span>: Choose The Target MCU &amp; Double-Click Its Name<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"521\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Choose-The-Part-Step-1024x521.png\" alt=\"STM32 CubeMX Choose The Part Step\" class=\"wp-image-4295\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Choose-The-Part-Step-1024x521.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Choose-The-Part-Step-300x153.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Choose-The-Part-Step-768x391.png 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Choose-The-Part-Step-600x305.png 600w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-CubeMX-Choose-The-Part-Step.png 1140w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step3<\/span>: Click On The Pin You Want To Configure As An Output &amp; Select Output Option<\/strong><\/p>\n\n\n\n<p>Let it be <span style=\"color: #ff0000;\"><strong>B13<\/strong><\/span> pin for example! (<span style=\"color: #333399;\"><strong>The onBoard LED Pin<\/strong><\/span>)<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step4<\/span>: Configure Timer2 Peripheral<\/strong><\/p>\n\n\n\n<p>As we&#8217;ve calculated earlier, the Prescaler will be 999, and the Preload value will be 7199. And the timer module will be clocked at the internal clock frequency.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"518\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-HAL-Interrupt-Example-Tutorial-CubeMX-Configuration.png\" alt=\"\" class=\"wp-image-11384\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-HAL-Interrupt-Example-Tutorial-CubeMX-Configuration.png 778w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-HAL-Interrupt-Example-Tutorial-CubeMX-Configuration-300x200.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-HAL-Interrupt-Example-Tutorial-CubeMX-Configuration-768x511.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step5<\/span>: Enable The Timer Interrupt Signal In NVIC Tab<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"320\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Tutorial-STM32-Timer-Explained.png\" alt=\"STM32 Timer HAL Interrupt Example Tutorial - STM32 Timer Explained\" class=\"wp-image-4590\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Tutorial-STM32-Timer-Explained.png 700w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Tutorial-STM32-Timer-Explained-300x137.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step6<\/span>: Set The RCC External Clock Source<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"682\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-RCC-External-Clock-Selection-CubeMX.png\" alt=\"STM32 RCC External Clock Selection CubeMX\" class=\"wp-image-4297\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-RCC-External-Clock-Selection-CubeMX.png 1020w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-RCC-External-Clock-Selection-CubeMX-300x201.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-RCC-External-Clock-Selection-CubeMX-768x514.png 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-RCC-External-Clock-Selection-CubeMX-600x401.png 600w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step7<\/span>: Go To The Clock Configuration<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step8<\/span>: Set The System Clock To Be 72MHz Or Whatever You Want<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"531\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Clock-Tree-Configuration-CubeMX-1024x531.png\" alt=\"STM32 Clock Tree Configuration CubeMX\" class=\"wp-image-4298\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Clock-Tree-Configuration-CubeMX-1024x531.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Clock-Tree-Configuration-CubeMX-300x156.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Clock-Tree-Configuration-CubeMX-768x398.png 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Clock-Tree-Configuration-CubeMX-600x311.png 600w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Clock-Tree-Configuration-CubeMX.png 1174w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step9<\/span>: Name &amp; Generate The Project Initialization Code For CubeIDE or The IDE You&#8217;re Using<\/strong><\/p>\n\n\n\n<p><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Then, open the project in the IDE you&#8217;re using. And head over to the main.c file. So we can start writing the application code and have a look at the initialization code generated by the STM32 CubeMX tool.<\/span><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-12032bb6 gb-headline-text\" id=\"stm32-timer-interrupt-example-code-in-cubemx-ide\"><strong>STM32 Timer Interrupt Example Code in CubeMX IDE<\/strong><\/h2>\n\n\n<p>Here is the generated initialization code in the main.c file<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#include \"main.h\"\n\nTIM_HandleTypeDef htim2;\n\nvoid SystemClock_Config(void);\nstatic void MX_GPIO_Init(void);\nstatic void MX_TIM2_Init(void);\n\nint main(void)\n{\n\n  HAL_Init();\n  SystemClock_Config();\n  MX_GPIO_Init();\n  MX_TIM2_Init();\n\n  while (1)\n  {\n\n  }\n\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">Now, the application we&#8217;re currently developing is an LED toggle in the ISR for the timer module. So, open the <code>stm32f1xx_it.c<\/code> file to find the timer interrupt handler, which is this function <code>TIM2_IRQHandler()<\/code>. Hover over the <code>HAL_TIM_IRQHandler()<\/code> function and right-click to navigate to its implementation.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">void TIM2_IRQHandler(void)\n{\n\n  HAL_TIM_IRQHandler(&amp;htim2);\n\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">After navigating to the timer interrupt handler routine, you&#8217;ll find the following implementation. In this code, we&#8217;re searching for the callback function&#8217;s name that gets called when an overflow interrupt occurs. You can notice that all sources share the same interrupt signal output compare match, overflow, input capture, etc.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)\n{\n  \/\/ Other timer interrupts events..\n  \/\/..\n  \/\/..\n  \/\/..\n  \/* TIM Update event *\/\n  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_UPDATE) != RESET)\n  {\n    if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_UPDATE) != RESET)\n    {\n      __HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE);\n      #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)\n        htim-&gt;PeriodElapsedCallback(htim);\n      #else\n        HAL_TIM_PeriodElapsedCallback(htim);\n      #endif \/* USE_HAL_TIM_REGISTER_CALLBACKS *\/\n    }\n  }\n  \/\/..\n  \/\/..\n  \/\/ Other timer interrupts events..\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">Now, we&#8217;ve got the callback function&#8217;s name that gets called whenever timer overflow occurs. It&#8217;s <code>HAL_TIM_PeriodElapsedCallback()<\/code>. So, we&#8217;ll write our own implementation for it in the application file (<code>main.c<\/code>). And a mention-worthy point is that you also have to enable (start) the timer so it gets clocked and starts counting, otherwise, it&#8217;ll remain IDLE.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Full LAB Code (main.c)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#include \"main.h\"\n\nTIM_HandleTypeDef htim2;\n\nvoid SystemClock_Config(void);\nstatic void MX_GPIO_Init(void);\nstatic void MX_TIM2_Init(void);\n\nint main(void)\n{\n\n  HAL_Init();\n  SystemClock_Config();\n  MX_GPIO_Init();\n  MX_TIM2_Init();\n  HAL_TIM_Base_Start_IT(&amp;htim2);\n\n  while (1)\n  {\n\n  }\n\n}\n\nvoid HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)\n{\n    HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_13);\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Build &amp; Flash The Code And Let&#8217;s Test The Results!<\/span><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-4d5708a3 gb-headline-text\" id=\"testing-the-stm32-timer-example-project\"><strong>Testing The STM32 Timer Example Project<\/strong><\/h2>\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step0<\/span>: Refer To The Blue Pill Board Schematic &amp; Pinout<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step1<\/span>: Connect The ST-Link To The USB Port &amp; SWD Pins On Board<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-GPIO-HAL-Led-Blinking-1024x576.jpg\" alt=\"STM32 GPIO HAL Led Blinking\" class=\"wp-image-4308\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-GPIO-HAL-Led-Blinking-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-GPIO-HAL-Led-Blinking-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-GPIO-HAL-Led-Blinking-768x432.jpg 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-GPIO-HAL-Led-Blinking-600x338.jpg 600w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-GPIO-HAL-Led-Blinking.jpg 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step2<\/span>: Click The Debug Button To Compile The Code &amp; Flash It To The Board &amp; Start A Debugging Session<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-justify has-medium-font-size\"><strong><span style=\"background-color: #ffcc00;\">Step3<\/span>: You Can Stop The Debugging Session Or Keep It Going. But You Need To Restart The MCU Once To Run The New Application At The Booting Process.<\/strong><\/p>\n\n\n<h3 class=\"gb-headline gb-headline-c3a454a2 gb-headline-text\" id=\"the-results-of-this-lab\"><span style=\"font-size: 14pt;\"><strong><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">The Results of This LAB<\/span><\/strong><\/span><\/h3>\n\n\n<p><strong>Test Video<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"STM32 Timer Interrupt HAL Example\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/chLNLZc47iI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><strong>Output Signal On My DSO<\/strong><\/p>\n\n\n\n<p><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">It&#8217;s a perfect 100ms time interval<\/span>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"480\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example.png\" alt=\"STM32 Timer HAL Interrupt Example\" class=\"wp-image-4595\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example.png 800w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-300x180.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-768x461.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-0f28caff gb-headline-text\" id=\"stm32-timer-finetiming-experiment\"><strong>STM32 Timer Fine-Timing Experiment<\/strong><\/h2>\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\"><strong>LAB Number<\/strong><\/span><\/td><td><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">8<\/span><\/td><\/tr><tr><td><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\"><strong>LAB Title<\/strong><\/span><\/td><td><span style=\"font-family: arial, helvetica, sans-serif; color: #000000;\">Timer Mode Periodic Event (in microseconds)<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"has-text-align-justify\">I&#8217;ve also done a couple of other experiments in which &#8220;fine&#8221; output time intervals are desired (from 50\u03bcs down to 1\u03bcs). The first of which was to produce a periodic timer interrupt every 50\u03bcSec. Hence the F<sub>CLK<\/sub> is 72MHz, and the Prescaler is left as 0 which means 1:1, therefore the auto-reload register&#8217;s value is found to be 3599 using the timer formula.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"221\" height=\"41\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-Interrupt-Equation.png\" alt=\"\" class=\"wp-image-11381\"\/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">Consequently, I changed these values in the code, rebuilt &amp; flashed it. And the result was a clean 50\u03bcSec waveform! As you can see in the screenshot below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"480\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Code.png\" alt=\"STM32 Timer HAL Interrupt Example Code\" class=\"wp-image-4597\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Code.png 800w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Code-300x180.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Code-768x461.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">Obviously, by changing the auto-reload register&#8217;s value from 3599 to 359, the output time interval should now be 5\u03bcSec. So, I did that, rebuilt &amp; flashed the code. The result was as expected a clean 5\u03bcSec time interval as you can see in the screenshot down below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"480\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Tutorial.png\" alt=\"STM32 Timer HAL Interrupt Example Tutorial\" class=\"wp-image-4598\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Tutorial.png 800w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Tutorial-300x180.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-HAL-Interrupt-Example-Tutorial-768x461.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">However, I do believe that there is a fundamental limitation for the timing resolution that can be enhanced by reducing the usage of HAL library functions and calling multiple functions in the process of handling various tasks.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-125d469c gb-headline-text\" id=\"using-stm32-timer-interrupt-calculator\"><strong>Using STM32 Timer Interrupt Calculator<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">This <strong><a href=\"https:\/\/deepbluembedded.com\/stm32-timer-calculator\/\" target=\"_blank\" rel=\"noreferrer noopener\">STM32 Timer Calculator<\/a><\/strong> online tool that we&#8217;ve built will help you find the optimal prescaler (PSC) and auto-reload (ARR) register values to generate your desired timer interrupt intervals with a click of a button. Give it a try and keep this <strong><a href=\"https:\/\/deepbluembedded.com\/electrical-electronics-calculators\/\" target=\"_blank\" rel=\"noreferrer noopener\">Embedded Systems Calculators &amp; Utilities<\/a><\/strong> page in your bookmarks to help you find these tools much quicker.<\/p>\n\n\n\n<p>Here is an example usage for the STM32 Timer Calculator where I wanted to generate a 10ms time interval using a 72MHz clock source.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-bdca9c3b\"><a href=\"https:\/\/deepbluembedded.com\/stm32-timer-calculator\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"434\" height=\"475\" class=\"gb-image gb-image-bdca9c3b\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-Calculator-Example-Use.png\" alt=\"STM32-Timer-Calculator-Example-Use\" title=\"STM32-Timer-Calculator-Example-Use\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-Calculator-Example-Use.png 434w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/12\/STM32-Timer-Calculator-Example-Use-274x300.png 274w\" sizes=\"auto, (max-width: 434px) 100vw, 434px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>To verify the result, we&#8217;ll use the timer formula as usual: <strong>T<sub>OUT<\/sub><\/strong> = <strong>(ARR+1)(PSC+1)\/72MHz<\/strong> = (12&#215;60000)\/72000000 = <strong>10ms<\/strong> (Exactly)<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p style=\"font-size:35px\"><strong>Required Parts For Example LABs<\/strong><\/p>\n\n\n\n<p>All the example code\/LABs\/projects in the series of tutorials are done using the dev boards below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/amzn.to\/3ckK9Fv\" target=\"_blank\" rel=\"noopener noreferrer\">Nucleo32-L432KC (ARM Cortex-M4 @ 80MHz) <\/a>&nbsp; or (<a href=\"https:\/\/www.ebay.com\/itm\/3DMakerWorld-STM32-Nucleo-32-Development-Board-with-STM32L432KC-MCU\/174461775378?hash=item289ebb6e12:g:T~EAAOSwFkxfd4vV&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a>)<\/strong><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/amzn.to\/3dmciNJ\" target=\"_blank\" rel=\"noopener noreferrer\">Blue Pill STM32-F103 (ARM Cortex-M3 @ 72MHz)<\/a>&nbsp; or (<a href=\"https:\/\/www.ebay.com\/itm\/2pcs-STM32F103C8T6-ARM-STM32-Development-Board-Module-Blue-Pill-ST-Link-V2-USA\/292168190439?_trkparms=ispr%3D1&amp;hash=item440694c9e7:g:OLIAAOSwKoRZatNr&amp;amdata=enc%3AAQAFAAACcBaobrjLl8XobRIiIML1V4Imu%252Fn%252BzU5L90Z278x5ickkvjzWOStkxwnlDuxSI1PVVishmq6rJVg8APnEJaohQfllGfV62Wy%252BPXAWmWoY2FsQRnRa859rqyxwPAsi%252BqsmfsG2Ow5mardad%252FBDPn6pT52vUMQF7kaGRsC6lif%252Bxor%252BpwgYT70BdXqQ5L1ocG2EOs53XqG%252Bh%252BhpQeVj5r3dkA0NggFZPfz8VOcSE6uQQFSQqM4cSvhXNLsO93IjKcZKJZ%252BKyKA73DarP5wl%252BDL7rBnbLetsSLQPS1bfUdqoFLl%252BTMN3RM4lTx6QL55fm%252FuFOVrSeWsIlSsnsHKzmPVsZ89VBYnzHRZtoGo%252FHHCspDtMvmUBrSjb2oj%252Bkq5vXsi8G3HyLtXukhpUtZ0fgL%252FmU8UupEhrhtCxsj6hE5dvaGfotGBohfvzENuuimtANFYXiEa0KNqjUj94pSyHWio1dXGZhTNSEBk8EO09cvdp6UsOMZ5xKflZBQJTcdW1ID81xePQI0uMHBijhhSEy7x9RxE3CRdV0IZndum1873Oz97iDRJr15z%252FvNyHpUaZOJpuMSWyUTpRgUlb5ODwmlofmXZy%252B%252BWc1vBZG8zdHva19QgS2RWiDZI6ArE6Bwv5Qj41mTkouUDoug5PHfvvd%252FpkdWLX4rQ%252B5vIzxVvBELoYewxBxKR5YRdFeNfhSXa0qi%252Fm98eaVbRml%252BcJBro3zbI73YFYBqjUM9wLNYfEo1P5mCvfDBHBA%252FnjUJUFw0qLSMl4e2YyLZAU7mLnEgRzvooSFcY4bmoSYVOqLKCVGRV2yrG%252FxNBuEy1gKpZ99GSd4kGAhA%253D%253D%7Ccksum%3A292168190439bb3feff92c784d1493693982f7aa90d2%7Campid%3APL_CLK%7Cclp%3A2334524&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a>)<\/strong><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/amzn.to\/2Awd8bW\" target=\"_blank\" rel=\"noopener noreferrer\">ST-Link v2 Debugger<\/a>&nbsp; or (<a href=\"https:\/\/www.ebay.com\/itm\/ST-Link-V2-Mini-STM8-STM32-STLINK-Simulator-Download-Programming-Unit-USA-SHIP\/233899997734?_trkparms=ispr%3D1&amp;hash=item367586ba26:g:EQkAAOSwMb5gLaQf&amp;amdata=enc%3AAQAFAAACcBaobrjLl8XobRIiIML1V4Imu%252Fn%252BzU5L90Z278x5ickkai8xCwosGKpC0NWj85e%252FB1BqfJ%252Be4x%252FDEeNluQDmrvzr33yBHyExM5mGanQPhEQWTkHNhycDTHjgnVkvKXJ9ixSvqh7C24ZVrOaU2otUrhnWZyBejzfYIMNGZjnp16xKZdF%252Btn%252B1W5dlYCqgcC0VI7du%252B1C8X17QEDQI3wdrJ3AVNquqOlsz%252Fc0ZKwY%252FiGd7B%252FFBsJQcMbS1VmoqQQLSaHYDviCC5izsYcHFZ%252BEDPMTmLq18zLesnJrS9OWS7OCwN7TBYJkYO0qpxfQFeukx4UmSxYzBYodR5vM1k12JPbs1quWprMNG%252B%252BRIsgPiKkzNePHNuM%252BNbsWltBv8xAilN7%252Baxal%252F8mTCSg81d9hKJWdzr5s8WtlK%252FXVq66FASt80eyhjQJyVPaq4R2sSNixJ8tq6Ei39xbccxuu44ICcH61zwQLS9KnTvXgHJB2Xoo60LZznHgj4uPVMFoP0ZKX1P4H8s44aEvDm6RiNyp1YOn1%252BPiVP4NWqS2Najl0jq4lDje5p29oFhbzbUT0WFTXmOs2BRygCgQOs4hndWAzNgfUJ8AOtLuewm6lbhc%252BEIYkh82NxGTWgkg3qSYIL%252Bkc23lLOHeuuiLxibXVDpwc2CCyWklTwOEXK4HCw%252Bd1y2nGjqOWOiypLncqJsSivqqc4nkOz%252FIBBNnT%252FklxIsKMbz1Pxf03WjlThVoraxI%252FbU7oI1GG6Mq3zOfWyxAtc6gHwg3rBDwPafN60sLH2JFuVA4emvqt9kWdiemmuep1HoMIxQZbr11ex2zSDEOaKl8GhWA%253D%253D%7Ccksum%3A23389999773448b71f25828240788ea9e947cbca204b%7Campid%3APL_CLK%7Cclp%3A2334524&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a>)<\/strong><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><span style=\"color: #ffffff;\">QTY<\/span><\/strong>#<\/td><td><span style=\"color: #ffffff;\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-contrast-color\"><strong>Component Name<\/strong><\/mark><\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span style=\"color: #ffffff;\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-contrast-color\"><strong><b>????&nbsp;<\/b>Amazon.com<\/strong><\/mark><\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span style=\"color: #ffffff;\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-contrast-color\"><strong><b>????&nbsp;<\/b>eBay.com<\/strong><\/mark><\/span><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">2<\/td><td><strong><span style=\"color: #000000;\">BreadBoard<\/span><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/2Mk0MGC\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/www.ebay.com\/itm\/3X-MB-102-830-Point-Prototype-PCB-Solderless-Breadboards-Protoboards-3Pcs-US\/192401566964?hash=item2ccc06ecf4:g:H8oAAOSwvytcIWLB&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong><span style=\"color: #000000;\">LEDs Kit<\/span><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/3gIDdFl\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a>&nbsp;<a href=\"https:\/\/amzn.to\/2Bg19zH\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/www.ebay.com\/itm\/150pcs-3mm-5mm-LED-Light-Emitting-Diode-White-Red-Green-Yellow-Assorted-DIY-Kit\/391368927437?_trkparms=ispr%3D1&amp;hash=item5b1f67e8cd:g:U5sAAOSwCypWpsoN&amp;amdata=enc%3AAQAFAAACcBaobrjLl8XobRIiIML1V4Imu%252Fn%252BzU5L90Z278x5ickkyMJZWL%252BqFSgQ3TOOe%252FNr7qlQBuGbs4AMXXcUbKs1EpZTyIodNnpBqmnPkEnTX9MH3RiGw7w4WPYXxIBFSYQ%252BJu8DC3DfJnkpzLpUbZxg5SWXL%252FTkoNqJP9MtA5Z2n7u4NslJcrL4xQPx%252F1Cz39v82rsX4zz9%252FeWwQjdqLatmLoTTj0ncisRs0mChQrG8iJ2Z6hy7qEbUurKqDnxzyiyXKTFVIaK4BetvZMIPonGJ4r4j3FIQKi5%252F96q7NCOhdxqGrytHlXjQ3ksYF2T9p6VueOsT4k4RTJoj5R%252FCqfjLuQOGW9FVTsgoUbsSbViKtnLOPD0V4n89iP1t2lNmFwFvjFUiLrSjfAHFweewvcrsCGh0pBWtdl6Boiz6wEue3Hw%252FRNINsNf%252BnaoeQOWFDYcHGLua%252BIR60bPIOubx%252BFagXquolzYG0RGz3sIXJBqqSUeyeI3Hf%252Fm6CyU2MN%252BFtyPScFmIA6AnVa3HM6XRZndTCABBxatzWlDaTTV%252BtE%252FSzzisQWNMtz83TTpIoGeobcFMrA%252BqDIBq%252B8mVQyNOBD1EW%252FfZDiC%252FTCE6hAcyVKMLnfaacfE2kXij2aOdyXAqZWftcvWOVpNmU1Gn%252FO8bP7klW0AUAz5Tu7sveHpPClFrdSBL2iyg%252BtsnVQEnzuWiFkGVqE3BsbF98tgJqXhAVHC5Eg5qI3%252FCVpCd4Cu02N7bl9Oxi6w9COzRtkKO5RlPNyhz7sSQQSEwOBzd%252B5vFON5xq6ilAx3OYE6NNQn51LMjY6VbGbD0%252Bu0xM9chUcQs2MIdPA%253D%253D%7Ccksum%3A3913689274374bdc5b588e1f44ba9c6cc3ecf6a94bc0%7Campid%3APL_CLK%7Cclp%3A2334524&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong><span style=\"color: #000000;\">Resistors Kit<\/span><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/3eDKJj0\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a>&nbsp;<a href=\"https:\/\/amzn.to\/2MgClKh\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/www.ebay.com\/itm\/1-4W-Metal-Film-Resistors-Assorted-kit-56-Values-1-ohm-5-6M-ohm-1-1120pcs\/260967968018?hash=item3cc2e72d12:g:pJkAAMXQO21RoNLa&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong><span style=\"color: #000000;\">Capacitors Kit<\/span><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/2LAIQsi\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a>&nbsp;<a href=\"https:\/\/amzn.to\/2Jjt4Aq\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/www.ebay.com\/itm\/500pc-Radial-Electrolytic-Capacitor-Assortment-Kit-24-Value-0-1uF-1000uF-10V-50V\/143439056287?epid=26036016622&amp;_trkparms=ispr%3D1&amp;hash=item2165a24d9f:g:Sj0AAOSwHP1dybYO&amp;amdata=enc%3AAQAFAAACgBaobrjLl8XobRIiIML1V4Imu%252Fn%252BzU5L90Z278x5ickk7d4nremBkvNKtcC0ZwqXDMfw5gxoQhZURpZ7CKoSc5xxVgJ%252Fy%252B9EYm8tD6jaOckmuAEphzCCUzDqXnxXDWvUTLUbOyZNFKa2fvXRfT2HYf1eLhXW2WILGwS%252BNpKqFPpCHbc%252BQiSMsg5NQv%252FF0SR3kuLTXEOCx94JjMtY2zPR6ntMqZLNVv8sGp%252BbpdkX7TRJluFdlncwYQhh6DVx1efMYJ%252BrUJKiz%252BkQNiCacB%252FhN4ruekRyCJOdmFqDiaj8E8C6JpBJY%252BkUSFYrR4ABjKr%252Fij6LeTS2v8uaAG8gaRU95qTjYRmgrH6PWu7awSHvKcVFTRyjvYPzKze2ewxnnZRLtH%252FzMobtozKqjG3dfuiwLx6ZkzITTRT%252FFq0XyuXm2ehJT1xSO%252BddPq5J9b2R9%252BQ71wZSTS0yznKZfKqZmkO3bLqSS90M1I%252FpYwt6ZOntAFU62xWvWXP1pVru8%252B2hymwkevuoRnO7%252B0Av5%252Frr4jH%252FT%252FRA6Ox%252FfW1hI8u0QfUmmUGtoG8u0afYbkUwQqQ84qCzovsdT7zDipWze%252BItQJ4pA1omUAUCigvx7bjm6R2lvxJ8pEabZ6veWZArmL%252F9ityZkbd2Oo%252BG9iQ33lOzkw5ZFGeyT4dXNQtO%252F4cfn4ibLUlJpRDcQYENPNMjddScQACOX1%252F5lw2uZt1mb6ljIguT03Dg3ia4Lre4I8NeW%252F4dxce53E4v2ocfbqZn4qJL25pf1lQuWkA1r0cj%252F7aanHRkrsMD016rf2%252F51Eo4c5GTvhY4iSoqRQ0UC%252BWfsMaEpPZjMvSu9zDC6BUinlxUvaSSOBo%253D%7Ccksum%3A143439056287c5bf367ff4db48a69783eef264cadaad%7Campid%3APL_CLK%7Cclp%3A2334524&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a>&nbsp;&amp;&nbsp;<a href=\"https:\/\/www.ebay.com\/itm\/1nF-22nF-Ceramic-Capacitors-Assorted-Kit-300pcs-15-Value-High-Voltage\/282939694736?_trkparms=ispr%3D1&amp;hash=item41e0851e90:g:KDwAAOSwEzxYOytw&amp;amdata=enc%3AAQAFAAACgBaobrjLl8XobRIiIML1V4Imu%252Fn%252BzU5L90Z278x5ickk7PdDazAlGltMLJlUhrWsD0ukQaJzBumHi1q2ML7KKgZxYpWYt2SxjwVcKWk0EOV66RjxoSIFiMra7sWKYPsd0ZzdmJdfvVy2z5mO2dogz50kT2EXBXZxyRdRD0INoIXu2UNteG7dUI%252Bm5DK2p3idtgXwINgnyArLb67VBrVUTGFHAHAXs%252FdPquG5yqgr62q96b9Y1g%252FGgipZO0Xm%252Bz1uP6xLXT%252FasJeTu1g5irQieq6joeW%252F3gVg8b5mKO2m60Zen2fkT3op0RFPEvzE62wFUAid83HT%252BplTDVYUYkMwDiK5Lw2cooGZabUtuKhUGKOs%252BusX1UxLR%252F1fcbEHPdzSrVh5gpNyPRajteLcMV%252BBxNNDPrexNOV6Ou81LgIKOnQdGTpyj1%252F3inCIGXi3mKlOlF%252BAxPCJRsuk3TgGWOsYVrpSvv6ROPBvXwh9rQajLpgLSpxOEVT10cvs6eyAIP%252B3PMWYZ72b2w39%252FqqgldLZE%252FFVB%252Fy%252BQIn40vEawJLEawrh%252FDRiCR%252B0JpEYIF%252FB%252FSCgsBwdsqO0qc%252BCKipDcP5M9KeaslvAuplt8%252BWWFp%252FAzRTSKzIoS3RRVC7CcfiRzR9pdxcvjNLAuY3jVrn07PCsvt55gZYsGJqjyMEeROq3aaJslhtClAkwmi97kQTUEN%252FlQIew4dWj%252BBTPiqwgtHTwGkZcDTbNjpnP6JUmR2Mgutp10nuj1r9BoQqPeruM7bNqhfI4CZLp0hudANl8BbZum7dWq%252F%252BSTPukAn7DfrhF3%252BFnRfGhhLfeZ5UOLswSUtxaRgK4R6gNqGsp6RiHASn3%252BAw%253D%7Ccksum%3A282939694736c5bf367ff4db48a69783eef264cadaad%7Campid%3APL_CLK%7Cclp%3A2334524&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">2<\/td><td><strong><span style=\"color: #000000;\">Jumper Wires Pack<\/span><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/2Xvs4gu\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a>&nbsp;<a href=\"https:\/\/amzn.to\/32cgJWk\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/www.ebay.com\/itm\/140Pcs-U-Shape-Solderless-Breadboard-Jumper-Cable-Wire-Kit-For-Arduino-Shield\/222743986356?hash=item33dc9380b4:g:R-MAAOSwoYhaJcBX&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a>&nbsp;&amp;&nbsp;<a href=\"https:\/\/www.ebay.com\/itm\/65pcs-Jumper-Wire-cable-kit-for-Solderless-Breadboard-New\/191674144210?hash=item2ca0ab55d2:g:e9MAAOxyUI1TImK7&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong><span style=\"color: #000000;\">9v Battery or DC Power Supply<\/span><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/2LIlPDG\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a>&nbsp;<a href=\"https:\/\/amzn.to\/2XsWoNE\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a>&nbsp;<a href=\"https:\/\/amzn.to\/2JhneiW\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/www.ebay.com\/itm\/Power-Supply-30V-5A-110V-Precision-Variable-DC-Digital-Adjustable-Lab-w-clip\/392507685302?epid=1638168615&amp;_trkparms=ispr%3D1&amp;hash=item5b6347f9b6:g:yuAAAOSw9Ctfkl98&amp;amdata=enc%3AAQAFAAACcBaobrjLl8XobRIiIML1V4Imu%252Fn%252BzU5L90Z278x5ickkyMJZWL%252BqFSgQ3TOOe%252FNr7kzzyT9cxbPNxOFKHZ78vxEYVNzNBQpCp%252BTP9LqH5V3VWaUojiH78SPl6D%252F2hfbCC3BgcfOd7NpXBplvDxPvTEJerKRovsBqwH856VktSnPbLJ%252BorVSb585ebl7n5vW6KukhRCqfBHwAH%252FyHB0fy2lmWTFmfy1CJoWPZHDsmJFSLmxYQrTnB33U9xL1XDnxUkU9dhSrVh9Lw6rO1%252FcsRl6TsfMs7AguLcvubEDOMTF66KCnOOgmvgDRNLvxj%252BC9t8pHrYoTojpJMFmtgEgpgo6vooV3QQ1t86rLSvaxpfTyuvna90h%252FUg4YzYoJ8KGwKF%252FIDrEghkUHr9DHIuUBW%252BFT0v0owyCUx3Td3Eb2onn5UKmteXuNAgbq3lGd7mrkA8haucjGMJJJk7zt6r4ImjTSLVv3PAI6yXRWVYBxKweXboK5Nd7kUkSh8LO4cfG9egjfcEIJadoUY%252BrDCYrjuWIJbu43ejaqLYl5ypS7VNXNspb5A5%252FcVNyIh88zVJdthUv%252B%252BLB2aY412ndRJ%252FRnMITr7RNtLaSUxfK%252FOhAZknZdnpTPfcAMlEyhI0WowYqT2lk0asLn0vh8Z6KfKSYHc1undVu0dZtQ4LS6w3N43G3ttkEHm7KOo4CdMu9Dqq%252B5hizE5s8UD817T%252BLiNBkhS8yXPPdtlYlm8JqQBV2qJviLKddTnEpWdkrrcNYkdAO7pa5XhHwKxp5%252FfN%252BDXDdFO6GjJwRbnYR2DUCsKN2ZaRk1S9DDXqidBuZfEM6AWYjxEzA%253D%253D%7Ccksum%3A392507685302c26dcebf2e2c489f96393a33ca3e353a%7Campid%3APL_CLK%7Cclp%3A2334524&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong><span style=\"color: #000000;\">Micro USB Cable<\/span><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/2TYhW0S\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/www.ebay.com\/itm\/3Pack-Micro-USB-Fast-Charger-Cable-Data-Sync-Cord-For-OEM-Samsung-LG-HTC-Android\/313109968839?_trkparms=ispr%3D1&amp;hash=item48e6cef7c7:g:YwgAAOSwlepe3oWy&amp;amdata=enc%3AAQAFAAACcBaobrjLl8XobRIiIML1V4Imu%252Fn%252BzU5L90Z278x5ickkRjLZq23gAR%252BKma9gM2Z1hoxx14pzNcPhUU50pkK1juK%252FDP0Yd0WY0Pmgr0NAPrtHKk2htzPu6%252FhAA8s%252BjJILI89p7ZKMMORLIJ4XUn5ckCFWJJ%252Bni9AR%252FdKoAjcQA0U0aJt1LzoxPxS26rS4yGu8R%252BRwc1WP%252FpZCtfVwBnsZZSWxuRF6%252FXJrWrF9q3uvYzCX9bMCDp4Qq0ySAepUPPL9%252F4fHjqpI5OmoOQJw1XBcWH9y%252FqAkGpz61tf28QvyVqm8HGPfFZHMbU7iEXxzj4rO0qrFVq5ZIzxcVeFotuTq6L0YysZIjW68u%252BHwYPGqpWM8UHPx221gGPizLTEEYk0JUGT%252BngtrU4y4n%252FoQvFjW1mgwArxaJuYeXPqNVQtzBb80YWjMU2Jwo1cK3TbeFwo8u56khbykr3qe74XV3B4c48gEo9S4NMYqmN%252BO3IJXAkoJv2%252BwB9giXtoKjy9%252BVzgvoId%252FiDx0MS29%252FN2ssfqWH3zVAEuHMwWdbhvptaL8t8X2e4OZMwDAbZtrcncs%252B%252FmC4rwSbQkbj1vD0DUP3EG%252BCbRli3y0HMmDEjUfTg8Q%252FbNgiSQzr%252BTZhICoC7UW%252FazZK%252Bit4VGlQ4jF9rsqljNdb0la3vA6U%252FYCEILlIjUgnnO%252FrJFRFHGy95mHnVZcdDuctWhTuy1VpCakoL3kSXVPMXpGnUYwPG6ludQlHQTR4Kfv%252FQ4lv001QomBIwrA3TH5mFFuWWl1PfY157FfeY4WrPF0QB7IHfmBTeEm8zopJw%252FjX3hP%252FqU8b9MrvdtqV7ei9A%253D%253D%7Ccksum%3A3131099688393e4f4ead2b4e40a68c68da9454280a60%7Campid%3APL_CLK%7Cclp%3A2334524&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong><span style=\"color: #000000;\">Push Buttons<\/span><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/2XIju00\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a>&nbsp;<a href=\"https:\/\/amzn.to\/3gIoaeU\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/www.ebay.com\/itm\/100Pcs-Tactile-Push-Button-Switch-Tact-Switch-6X6X5mm-4-pin-DIP\/400985228772?hash=item5d5c9505e4:g:TDsAAOSwcu5UNir1&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noopener\">eBay<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u2605 Check The Full Course Complete Kit List &amp; LAB Test Equipment Required For Debugging<\/p>\n\n\n<div class=\"gb-grid-wrapper gb-grid-wrapper-b5584414\">\n<div class=\"gb-grid-column gb-grid-column-ebcf2214\"><div class=\"gb-container gb-container-ebcf2214\">\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-font-size has-medium-font-size\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.amazon.com\/shop\/deepbluembedded\/list\/3LL3YY04LYLB2?ref_=aipsflist_aipsfdeepbluembedded\" style=\"border-radius:50px\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>STM32 Course Kit<\/strong><\/a><\/div>\n<\/div>\n\n<\/div><\/div>\n\n<div class=\"gb-grid-column gb-grid-column-d8907ea3\"><div class=\"gb-container gb-container-d8907ea3\">\n\n<div class=\"wp-block-buttons has-custom-font-size has-medium-font-size is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.amazon.com\/shop\/deepbluembedded\/list\/M3ZPJRV7AC01?ref_=aipsflist_aipsfdeepbluembedded\" style=\"border-radius:50px\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>LAB Test Equipment Setup<\/strong><\/a><\/div>\n<\/div>\n\n<\/div><\/div>\n<\/div>\n\n\n<p style=\"font-size:35px\"><strong>Download Attachments<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-justify\">You can download all attachment files for this Article\/Tutorial (project files, schematics, code, etc..) using the link below. Please consider supporting my work through the various support options listed in the link down below. Every small donation helps to keep this website up and running and ultimately supports our community.<\/p>\n\n\n<div class=\"gb-grid-wrapper gb-grid-wrapper-1e2f191b\">\n<div class=\"gb-grid-column gb-grid-column-02c4d3f1\"><div class=\"gb-container gb-container-02c4d3f1\">\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-50 has-custom-font-size has-medium-font-size\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/drive.google.com\/file\/d\/1MlXCLzJ82qI1Kie9Xa3AgHHdGYr_ZAVL\/view?usp=sharing\" style=\"border-radius:50px\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>DOWNLOAD<\/strong><\/a><\/div>\n<\/div>\n\n<\/div><\/div>\n\n<div class=\"gb-grid-column gb-grid-column-797e5644\"><div class=\"gb-container gb-container-797e5644\">\n\n<div class=\"wp-block-buttons has-custom-font-size has-medium-font-size is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-50\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/deepbluembedded.com\/support-me\/\" style=\"border-radius:50px\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>DONATE HERE<\/strong><\/a><\/div>\n<\/div>\n\n<\/div><\/div>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-cd52fc6e gb-headline-text\" id=\"wrap-up\"><strong>Wrap Up<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">To conclude this tutorial, we&#8217;d like to highlight the fact that the STM32 hardware timers can easily be configured to generate periodic timer interrupt events that we&#8217;ll heavily depend on in a later tutorial while making our way to develop real-time systems with STM32 microcontrollers. This tutorial is a fundamental part of our&nbsp;STM32 Series of Tutorials&nbsp;because we\u2019ll use it in many tutorials and projects hereafter. So make sure, you\u2019ve learned all the concepts and implemented the practice examples.<\/p>\n\n\n\n<p>If you&#8217;re just getting started with STM32, you need to check out the&nbsp;<a href=\"https:\/\/deepbluembedded.com\/getting-started-with-stm32-arm-cortex-mcus\/\"><strong>STM32 Getting Started Tutorial<\/strong><\/a>&nbsp;here.<\/p>\n\n\n\n<p>And follow this&nbsp;<strong><a href=\"https:\/\/deepbluembedded.com\/stm32-arm-programming-tutorials\/\">STM32 Series of Tutorials<\/a><\/strong>&nbsp;to learn more about STM32 Microcontrollers Programming.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><a href=\"https:\/\/deepbluembedded.com\/stm32-timers-tutorial-hardware-timers-explained\/\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1666 alignleft\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256L-150x150.png\" alt=\"Previous Tutorial\" width=\"35\" height=\"35\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256L-150x150.png 150w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256L-160x160.png 160w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256L-320x320.png 320w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256L-50x50.png 50w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256L.png 256w\" sizes=\"auto, (max-width: 35px) 100vw, 35px\" \/><\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"2\"><a href=\"https:\/\/deepbluembedded.com\/stm32-timers-tutorial-hardware-timers-explained\/\"><strong>Previous Tutorial<\/strong><\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"2\"><span style=\"color: #000000;\"><strong><span style=\"font-size: 14pt;\">Tutorial 13<\/span><\/strong><\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"2\"><a href=\"https:\/\/deepbluembedded.com\/stm32-counter-mode-example-frequency-counter-timer-in-counter-mode\/\"><strong>Next Tutorial<\/strong><\/a><\/td><td><a href=\"https:\/\/deepbluembedded.com\/stm32-counter-mode-example-frequency-counter-timer-in-counter-mode\/\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1667 alignright\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256-150x150.png\" alt=\"Next Tutorial\" width=\"35\" height=\"35\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256-150x150.png 150w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256-160x160.png 160w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256-320x320.png 320w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256-50x50.png 50w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2018\/06\/play-256.png 256w\" sizes=\"auto, (max-width: 35px) 100vw, 35px\" \/><\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p> &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"STM32 Timer Interrupt HAL Example &#8211; Timer Mode LAB\" class=\"read-more button\" href=\"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#more-4583\" aria-label=\"Read more about STM32 Timer Interrupt HAL Example &#8211; Timer Mode LAB\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":4599,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28,30,103],"tags":[308],"class_list":["post-4583","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-embedded-systems","category-embedded-tutorials","category-stm32-arm","tag-stm32-core","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>STM32 Timer Interrupt HAL Example - Timer Mode LAB &#8211; DeepBlue<\/title>\n<meta name=\"description\" content=\"STM32 Timer interrupt HAL example. CubeMX CubeIDE timer mode with interrupt tutorial and example. PWM mode, encoder mode, DMA\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"STM32 Timer Interrupt HAL Example - Timer Mode LAB &#8211; DeepBlue\" \/>\n<meta property=\"og:description\" content=\"STM32 Timer interrupt HAL example. CubeMX CubeIDE timer mode with interrupt tutorial and example. PWM mode, encoder mode, DMA\" \/>\n<meta property=\"og:url\" content=\"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/\" \/>\n<meta property=\"og:site_name\" content=\"DeepBlue\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/khaled.elrawy.359\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/khaled.elrawy.359\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-19T10:08:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-17T13:00:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"340\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Khaled Magdy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khaled Magdy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/\"},\"author\":{\"name\":\"Khaled Magdy\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"headline\":\"STM32 Timer Interrupt HAL Example &#8211; Timer Mode LAB\",\"datePublished\":\"2020-06-19T10:08:29+00:00\",\"dateModified\":\"2025-02-17T13:00:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/\"},\"wordCount\":1411,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"image\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg\",\"keywords\":[\"STM32 Core\"],\"articleSection\":[\"Embedded Systems\",\"Embedded Tutorials\",\"STM32 ARM\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/\",\"name\":\"STM32 Timer Interrupt HAL Example - Timer Mode LAB &#8211; DeepBlue\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg\",\"datePublished\":\"2020-06-19T10:08:29+00:00\",\"dateModified\":\"2025-02-17T13:00:54+00:00\",\"description\":\"STM32 Timer interrupt HAL example. CubeMX CubeIDE timer mode with interrupt tutorial and example. PWM mode, encoder mode, DMA\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/#primaryimage\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg\",\"contentUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg\",\"width\":720,\"height\":340,\"caption\":\"STM32 Timers Explained Tutorial - Timer interrupt HAL Example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-timer-interrupt-hal-example-timer-mode-lab\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/deepbluembedded.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"STM32 Timer Interrupt HAL Example &#8211; Timer Mode LAB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#website\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/\",\"name\":\"DeepBlueMbedded\",\"description\":\"Embedded Systems And Computer Engineering Tutorials &amp; Articles\",\"publisher\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/deepbluembedded.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\",\"name\":\"Khaled Magdy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"caption\":\"Khaled Magdy\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\"},\"description\":\"Principal Embedded Systems Engineer with years of experience in embedded software and hardware design. I work in the Automotive &amp; e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI\\\/ML, and other fields I'm passionate about. I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?\",\"sameAs\":[\"https:\\\/\\\/deepbluembedded.com\",\"https:\\\/\\\/www.facebook.com\\\/khaled.elrawy.359\\\/\",\"https:\\\/\\\/www.instagram.com\\\/deepbluembedded\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/khaled-magdy-\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCzLSrNZD4rCjSCOVU9hknvA\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"STM32 Timer Interrupt HAL Example - Timer Mode LAB &#8211; DeepBlue","description":"STM32 Timer interrupt HAL example. CubeMX CubeIDE timer mode with interrupt tutorial and example. PWM mode, encoder mode, DMA","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:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/","og_locale":"en_US","og_type":"article","og_title":"STM32 Timer Interrupt HAL Example - Timer Mode LAB &#8211; DeepBlue","og_description":"STM32 Timer interrupt HAL example. CubeMX CubeIDE timer mode with interrupt tutorial and example. PWM mode, encoder mode, DMA","og_url":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/","og_site_name":"DeepBlue","article_publisher":"https:\/\/www.facebook.com\/khaled.elrawy.359\/","article_author":"https:\/\/www.facebook.com\/khaled.elrawy.359\/","article_published_time":"2020-06-19T10:08:29+00:00","article_modified_time":"2025-02-17T13:00:54+00:00","og_image":[{"width":720,"height":340,"url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg","type":"image\/jpeg"}],"author":"Khaled Magdy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Khaled Magdy","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#article","isPartOf":{"@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/"},"author":{"name":"Khaled Magdy","@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"headline":"STM32 Timer Interrupt HAL Example &#8211; Timer Mode LAB","datePublished":"2020-06-19T10:08:29+00:00","dateModified":"2025-02-17T13:00:54+00:00","mainEntityOfPage":{"@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/"},"wordCount":1411,"commentCount":5,"publisher":{"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"image":{"@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#primaryimage"},"thumbnailUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg","keywords":["STM32 Core"],"articleSection":["Embedded Systems","Embedded Tutorials","STM32 ARM"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/","url":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/","name":"STM32 Timer Interrupt HAL Example - Timer Mode LAB &#8211; DeepBlue","isPartOf":{"@id":"https:\/\/deepbluembedded.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#primaryimage"},"image":{"@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#primaryimage"},"thumbnailUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg","datePublished":"2020-06-19T10:08:29+00:00","dateModified":"2025-02-17T13:00:54+00:00","description":"STM32 Timer interrupt HAL example. CubeMX CubeIDE timer mode with interrupt tutorial and example. PWM mode, encoder mode, DMA","breadcrumb":{"@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#primaryimage","url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg","contentUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg","width":720,"height":340,"caption":"STM32 Timers Explained Tutorial - Timer interrupt HAL Example"},{"@type":"BreadcrumbList","@id":"https:\/\/deepbluembedded.com\/stm32-timer-interrupt-hal-example-timer-mode-lab\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/deepbluembedded.com\/"},{"@type":"ListItem","position":2,"name":"STM32 Timer Interrupt HAL Example &#8211; Timer Mode LAB"}]},{"@type":"WebSite","@id":"https:\/\/deepbluembedded.com\/#website","url":"https:\/\/deepbluembedded.com\/","name":"DeepBlueMbedded","description":"Embedded Systems And Computer Engineering Tutorials &amp; Articles","publisher":{"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/deepbluembedded.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867","name":"Khaled Magdy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","caption":"Khaled Magdy"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g"},"description":"Principal Embedded Systems Engineer with years of experience in embedded software and hardware design. I work in the Automotive &amp; e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI\/ML, and other fields I'm passionate about. I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?","sameAs":["https:\/\/deepbluembedded.com","https:\/\/www.facebook.com\/khaled.elrawy.359\/","https:\/\/www.instagram.com\/deepbluembedded\/","https:\/\/www.linkedin.com\/in\/khaled-magdy-\/","https:\/\/www.youtube.com\/channel\/UCzLSrNZD4rCjSCOVU9hknvA"]}]}},"jetpack_featured_media_url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timers-Explained-Tutorial-Timer-interrupt-HAL-Example.jpg","jetpack_shortlink":"https:\/\/wp.me\/p9SirL-1bV","jetpack-related-posts":[{"id":12018,"url":"https:\/\/deepbluembedded.com\/stm32-adc-timer-trigger-example-external-trigger-sources\/","url_meta":{"origin":4583,"position":0},"title":"STM32 ADC Timer Trigger Example &amp; External Trigger Sources","author":"Khaled Magdy","date":"January 29, 2024","format":false,"excerpt":"In this tutorial, we'll discuss the STM32 ADC Timer Trigger & External Trigger Sources For ADC channels' conversion starting instead of the software-triggered mode that we've discussed in previous tutorials. Using the timer as a trigger source for the ADC allows for periodic ADC conversions to achieve whatever ADC sampling\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32 ADC Timer Trigger Example & External Trigger Sources","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-ADC-Timer-Trigger-Example-External-Trigger-Sources.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-ADC-Timer-Trigger-Example-External-Trigger-Sources.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-ADC-Timer-Trigger-Example-External-Trigger-Sources.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-ADC-Timer-Trigger-Example-External-Trigger-Sources.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-ADC-Timer-Trigger-Example-External-Trigger-Sources.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":4692,"url":"https:\/\/deepbluembedded.com\/stm32-delay-microsecond-millisecond-utility-dwt-delay-timer-delay\/","url_meta":{"origin":4583,"position":1},"title":"STM32 delay us Microseconds (STM32 DWT &#038; Timer Delay)","author":"Khaled Magdy","date":"June 23, 2020","format":false,"excerpt":"In this tutorial, you'll learn how to implement STM32 delay_us & delay_ms functions (microseconds and milliseconds delay). We've previously discussed the HAL_Delay() utility in the built-in HAL libraries by STMicroelectronics. Which could only give us a milliseconds delay. Therefore, in this tutorial, we'll discuss the STM32 DWT and use it\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32 Delay_us Microseconds Delay DWT + HAL Timer Delay Function","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/02\/STM32-Delay_us-Microseconds-Delay-DWT-HAL-Timer-Delay-Function.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/02\/STM32-Delay_us-Microseconds-Delay-DWT-HAL-Timer-Delay-Function.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/02\/STM32-Delay_us-Microseconds-Delay-DWT-HAL-Timer-Delay-Function.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/02\/STM32-Delay_us-Microseconds-Delay-DWT-HAL-Timer-Delay-Function.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/02\/STM32-Delay_us-Microseconds-Delay-DWT-HAL-Timer-Delay-Function.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":4603,"url":"https:\/\/deepbluembedded.com\/stm32-counter-mode-example-frequency-counter-timer-in-counter-mode\/","url_meta":{"origin":4583,"position":2},"title":"STM32 Counter Mode Example &#8211; Frequency Counter | Timer In Counter Mode","author":"Khaled Magdy","date":"June 20, 2020","format":false,"excerpt":"Previous Tutorial Tutorial 14 Next Tutorial STM32 Timers - STM32 Counter Mode LAB STM32 Course Home Page ???? \u00a0 \u00a0 In this article, we'll be discussing the timer module operation in counter mode (STM32 Counter). How to configure a timer as a counter, and what are the possible configuration options.\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32 Frequency Counter Project - Timer Module Counter Mode Frequency Counter","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Frequency-Counter-Project-Timer-Module-Counter-Mode-Frequency-Counter.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Frequency-Counter-Project-Timer-Module-Counter-Mode-Frequency-Counter.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Frequency-Counter-Project-Timer-Module-Counter-Mode-Frequency-Counter.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Frequency-Counter-Project-Timer-Module-Counter-Mode-Frequency-Counter.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4671,"url":"https:\/\/deepbluembedded.com\/stm32-timer-encoder-mode-stm32-rotary-encoder-interfacing\/","url_meta":{"origin":4583,"position":3},"title":"STM32 Timer Encoder Mode &#8211; STM32 Rotary Encoder Interfacing","author":"Khaled Magdy","date":"June 22, 2020","format":false,"excerpt":"Previous Tutorial Tutorial 17 Next Tutorial STM32 Timer Encoder Mode - STM32 Rotary Encoder Interfacing STM32 Course Home Page ???? \u00a0 \u00a0 In this tutorial, we'll discuss the STM32 Timer encoder mode. We'll also do STM32 rotary encoder interfacing using the timer module in encoder mode. And we'll use it\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-Encoder-STM32-Encoder-Mode-Example-Tutorial-Rotary-Encoder.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-Encoder-STM32-Encoder-Mode-Example-Tutorial-Rotary-Encoder.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-Encoder-STM32-Encoder-Mode-Example-Tutorial-Rotary-Encoder.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-Timer-Encoder-STM32-Encoder-Mode-Example-Tutorial-Rotary-Encoder.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":12479,"url":"https:\/\/deepbluembedded.com\/stm32-comparator-example-tutorial-internal-analog-comparator\/","url_meta":{"origin":4583,"position":4},"title":"STM32 Comparator Tutorial + Example (Internal Analog Comparator)","author":"Khaled Magdy","date":"March 31, 2024","format":false,"excerpt":"In this tutorial, we'll discuss how the STM32 Internal Analog Comparator works, and how to use the STM32 Comparator with the timer in input capture mode for signal measurement. The STM32 comparator's output can be externally and\/or internally routed to different peripherals which opens the door for a wide range\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32 Comparator Tutorial + Example (Internal Analog Comparator)","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/03\/STM32-Comparator-Tutorial-Examples.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/03\/STM32-Comparator-Tutorial-Examples.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/03\/STM32-Comparator-Tutorial-Examples.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/03\/STM32-Comparator-Tutorial-Examples.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/03\/STM32-Comparator-Tutorial-Examples.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":13804,"url":"https:\/\/deepbluembedded.com\/stm32-pwm-phase-shift-timer-synchronized-example-code\/","url_meta":{"origin":4583,"position":5},"title":"STM32 PWM Phase Shift (Timer Synchronized) + Example Code","author":"Khaled Magdy","date":"February 6, 2025","format":false,"excerpt":"In this tutorial, we'll discuss The STM32 PWM Phase Shift and how to configure and use the Synchronized Timer Slave Mode With PWM in STM32 microcontrollers to generate phase-shifted PWM output signals with programmable phase angles (45\u00b0, 90\u00b0, 120\u00b0, etc). We'll implement the STM32 PWM Phase Shift in a code\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32 PWM Phase Shift (Timer Synchronized) + Example Code","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2025\/02\/STM32-PWM-Phase-Shift-Timer-Synchronized-Example-Code.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2025\/02\/STM32-PWM-Phase-Shift-Timer-Synchronized-Example-Code.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2025\/02\/STM32-PWM-Phase-Shift-Timer-Synchronized-Example-Code.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2025\/02\/STM32-PWM-Phase-Shift-Timer-Synchronized-Example-Code.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2025\/02\/STM32-PWM-Phase-Shift-Timer-Synchronized-Example-Code.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/4583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/comments?post=4583"}],"version-history":[{"count":14,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/4583\/revisions"}],"predecessor-version":[{"id":13917,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/4583\/revisions\/13917"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/media\/4599"}],"wp:attachment":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/media?parent=4583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/categories?post=4583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/tags?post=4583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}