{"id":1966,"date":"2023-09-12T06:13:42","date_gmt":"2023-09-12T06:13:42","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=1966"},"modified":"2023-09-12T06:13:43","modified_gmt":"2023-09-12T06:13:43","slug":"getting-started-with-stm32l053-external-interrupt","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=1966","title":{"rendered":"Getting started with STM32L053: External Interrupt"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"513\" height=\"513\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/M0-Corenew.jpg.webp\" alt=\"\" class=\"wp-image-1967\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/M0-Corenew.jpg.webp 513w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/M0-Corenew.jpg-300x300.webp 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/M0-Corenew.jpg-150x150.webp 150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/M0-Corenew.jpg-400x400.webp 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/M0-Corenew.jpg-250x250.webp 250w\" sizes=\"(max-width: 513px) 100vw, 513px\" \/><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>In this guide, we shall develop a driver for external interrupt in STM32L053-Nucleo-64 board. <\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>What is external interrupt.<\/li><li>Developing external interrupt driver.<\/li><li>Results.<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. What is External interrupt:<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">External Interrupts :&nbsp;<\/h3>\n\n\n\n<p>External interrupts come from input-output I\/O devices.&nbsp;<\/p>\n\n\n\n<p><strong>Some examples that cause external interrupts:&nbsp;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>&nbsp;I\/O devices requesting transfer of data&nbsp;<\/li><li>&nbsp;I\/O devices finished the transfer of data. When a program executes in an endless loop and thus exceeds its time limit, an external interrupt occurs which is Timeout Interrupt.<\/li><li>While transferring the CPU\u2019s complete state to a non-destructive memory in a few milliseconds before power ceases, then an external interrupt occurs.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Advantages of External Interrupts<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Increased Flexibility:&nbsp;<\/strong>External interrupts allow a system to respond to external events, such as a user input or an external sensor, in real-time. This can greatly improve the system\u2019s flexibility, as it is not limited to a fixed operating cycle.<\/li><li><strong>Ability to Respond to External Events:&nbsp;<\/strong>External interrupts provide a mechanism for the system to respond to external events that may occur at any time. This allows the system to perform tasks in response to changes in the environment, such as user input or incoming data, without the need for continuous monitoring.<\/li><li><strong>Improved Performance and Efficiency:&nbsp;<\/strong>By allowing the system to respond to external events in real-time, external interrupts can greatly improve the system\u2019s performance and efficiency, as it is not bogged down by continuous monitoring for changes.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Applications of External Interrupts<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Input Devices:&nbsp;<\/strong>External interrupts are commonly used in input devices, such as keyboards, mice, and touchpads, to respond to user input in real-time.<\/li><li><strong>Data Acquisition Systems:&nbsp;<\/strong>External interrupts can be used in data acquisition systems to respond to incoming data and process it in real-time.<\/li><li><strong>Robotics:&nbsp;<\/strong>External interrupts can be used in robotics systems to respond to external events, such as sensor inputs or user commands.<\/li><li><strong>Real-time Systems:&nbsp;<\/strong>External interrupts are commonly used in real-time systems, such as process control systems and medical equipment, to provide a mechanism for responding to external events in real-time.<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Developing external interrupt driver:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Before we start developing the driver, we need to set the PC13 as input, please refer to <a href=\"https:\/\/blog.embeddedexpert.io\/?p=865\" data-type=\"URL\" data-id=\"https:\/\/blog.embeddedexpert.io\/?p=865\" target=\"_blank\" rel=\"noreferrer noopener\">this<\/a> guide for how to set PC13 as input.<\/p>\n\n\n\n<p>Also, we need PA5 as output which is connected to onboard LED, please refer to <a rel=\"noreferrer noopener\" href=\"https:\/\/blog.embeddedexpert.io\/?p=837\" data-type=\"URL\" data-id=\"https:\/\/blog.embeddedexpert.io\/?p=837\" target=\"_blank\">this<\/a> guide.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>We start of by enabling clock access to SYSCNFG as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"401\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-1024x401.png\" alt=\"\" class=\"wp-image-1968\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-1024x401.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-300x117.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-768x301.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-1536x601.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-2048x802.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-1150x450.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-750x294.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-400x157.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.01.20-AM-250x98.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">\t\/*Enable clock access to sysconfig*\/\n\tRCC-&gt;APB2ENR|=RCC_APB2ENR_SYSCFGEN;<\/pre><\/div>\n\n\n\n<p>We need to configure EXTI13 to be on portC as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"514\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-1024x514.png\" alt=\"\" class=\"wp-image-1969\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-1024x514.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-300x151.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-768x385.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-1536x771.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-2048x1028.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-1150x577.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-750x376.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-400x201.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.04.14-AM-250x125.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">\t\/*Set EXTI13 to be on PORTC of GPIO*\/\n\tSYSCFG-&gt;EXTICR[3]|=SYSCFG_EXTICR4_EXTI13_PC;<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Unmask interrupt request from line 13 as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"756\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-1024x756.png\" alt=\"\" class=\"wp-image-1970\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-1024x756.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-300x222.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-768x567.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-1536x1134.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-2048x1512.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-1150x849.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-750x554.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-400x295.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.06.10-AM-250x185.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">\t\/*Unmask Line 13*\/\n\tEXTI-&gt;IMR|=EXTI_IMR_IM13;<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Set the edge detection to be falling edge:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"611\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-1024x611.png\" alt=\"\" class=\"wp-image-1971\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-1024x611.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-300x179.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-768x458.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-1536x917.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-2048x1222.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-1150x686.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-750x448.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-400x239.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-12-at-9.08.07-AM-250x149.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">\t\/*Select falling edge detection*\/\n\tEXTI-&gt;FTSR|=EXTI_FTSR_FT13;<\/pre><\/div>\n\n\n\n<p>Finally enable the EXTI13 in NVIC as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">\t\/*Enable EXTI line in NVIC*\/\n\tNVIC_EnableIRQ(EXTI4_15_IRQn);<\/pre><\/div>\n\n\n\n<p>Note that EXTI4 to EXTI15 share same interrupt line.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Within the interrupt handler:<\/p>\n\n\n\n<p>Check if the source of the interrupt is line 13:<\/p>\n\n\n\n<p>If it is line 13, clear the pending flag and toggle the LED.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">void EXTI4_15_IRQHandler(void)\n{\n\n\t\/*Check if the interrupt source is line13*\/\n\tif (EXTI-&gt;PR &amp; EXTI_PR_PIF13)\n\t{\n\t\t\/*Clear the pending flag*\/\n\t\tEXTI-&gt;PR|=EXTI_PR_PIF13;\n\n\t\t\/*Toggle the LED*\/\n\t\tGPIOA-&gt;ODR^=GPIO_ODR_OD5;\n\t}\n}<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Hence, the entire code as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#include  &quot;stm32l0xx.h&quot;\n\nint main(void)\n{\n\t\/*Enable clock access to GPIOA*\/\n\tRCC-&gt;IOPENR |= RCC_IOPENR_GPIOAEN;\n\t\/*Enable clock access to GPIOC*\/\n\tRCC-&gt;IOPENR |= RCC_IOPENR_GPIOCEN;\n\n\t\/*Set PA5 as output pin*\/\n\tGPIOA-&gt;MODER |= GPIO_MODER_MODE5_0;\n\tGPIOA-&gt;MODER  &amp;=~GPIO_MODER_MODE5_1;\n\t\/* Set PC13 as input*\/\n\tGPIOC-&gt;MODER&amp;=~ GPIO_MODER_MODE13;\n\n\t\/*Enable clock access to sysconfig*\/\n\tRCC-&gt;APB2ENR|=RCC_APB2ENR_SYSCFGEN;\n\n\t\/*Set EXTI13 to be on PORTC of GPIO*\/\n\tSYSCFG-&gt;EXTICR[3]|=SYSCFG_EXTICR4_EXTI13_PC;\n\n\t\/*Unmask Line 13*\/\n\tEXTI-&gt;IMR|=EXTI_IMR_IM13;\n\n\t\/*Select falling edge detection*\/\n\tEXTI-&gt;FTSR|=EXTI_FTSR_FT13;\n\n\t\/*Enable EXTI line in NVIC*\/\n\tNVIC_EnableIRQ(EXTI4_15_IRQn);\n\n\twhile(1)\n\t{\n\n\t}\n\n}\n\nvoid EXTI4_15_IRQHandler(void)\n{\n\n\t\/*Check if the interrupt source is line13*\/\n\tif (EXTI-&gt;PR &amp; EXTI_PR_PIF13)\n\t{\n\t\t\/*Clear the pending flag*\/\n\t\tEXTI-&gt;PR|=EXTI_PR_PIF13;\n\n\t\t\/*Toggle the LED*\/\n\t\tGPIOA-&gt;ODR^=GPIO_ODR_OD5;\n\t}\n}\n<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Results:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>When you upload the code to your MCU and press the user button, you should see the LED toggle with each press as shown in this video:<\/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=\"LED toggle using push-button on STM32L053\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/ffLREAUvsQQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Happy coding \ud83d\ude42 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we shall develop a driver for external interrupt in STM32L053-Nucleo-64 board. In this guide, we shall cover the following: What is external interrupt. Developing external interrupt driver. Results. 1. What is External interrupt: External Interrupts :&nbsp; External interrupts come from input-output I\/O devices.&nbsp; Some examples that cause external interrupts:&nbsp; &nbsp;I\/O devices requesting [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,11,12],"tags":[],"class_list":["post-1966","post","type-post","status-publish","format-standard","hentry","category-embedded-systems","category-peripheral-drivers","category-stm32"],"_links":{"self":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1966"}],"collection":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1966"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1966\/revisions"}],"predecessor-version":[{"id":1972,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1966\/revisions\/1972"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}