{"id":1977,"date":"2023-09-17T05:24:12","date_gmt":"2023-09-17T05:24:12","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=1977"},"modified":"2023-09-17T05:24:17","modified_gmt":"2023-09-17T05:24:17","slug":"emulating-parallel-port-using-timer-and-dma-part-2-1-adding-strobe-signal-to-output","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=1977","title":{"rendered":"Emulating Parallel Port using Timer and DMA Part 2.1: Adding Strobe Signal to Output"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-1024x1024.jpeg\" alt=\"\" class=\"wp-image-1978\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-1024x1024.jpeg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-300x300.jpeg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-150x150.jpeg 150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-768x768.jpeg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-1536x1536.jpeg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-2048x2048.jpeg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-1150x1150.jpeg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-750x750.jpeg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-400x400.jpeg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/AdobeStock_92843412-1-250x250.jpeg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>In the previous guide (<a rel=\"noreferrer noopener\" href=\"https:\/\/blog.embeddedexpert.io\/?p=1973\" data-type=\"URL\" data-id=\"https:\/\/blog.embeddedexpert.io\/?p=1973\" target=\"_blank\">here<\/a>), we took a look at what is parallel port and successfully send byte of data using timer and DMA.<\/p>\n\n\n\n<p>In this guide, we shall add the strobe signal which will be an essential part in the next part of the guide.<\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>What is strobe signal.<\/li><li>Adding the strobe signal.<\/li><li>Connecting the LED for strobe indication.<\/li><li>Results.<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. What is Strobe Signal in Parallel Communication:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Strobe I\/O<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>In many applications, valid data is present on an external device only at a certain time, so it must be read in at that time.<\/li><li>E.g. the ASCII-encoded keyboard. When a key is pressed, circuitry on the keyboard sends out the ASCII code for the pressed key on eight parallel data lines, and then sends out a strobe signal on another line to indicate that valid data is present on the eight data lines.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/2.bp.blogspot.com\/-txGav2tR_EU\/VmG4yZkLoXI\/AAAAAAAAAs4\/K-kiij_Oo5w\/s1600\/2.JPG\"><img decoding=\"async\" src=\"https:\/\/2.bp.blogspot.com\/-txGav2tR_EU\/VmG4yZkLoXI\/AAAAAAAAAs4\/K-kiij_Oo5w\/s640\/2.JPG\" alt=\"\" \/><\/a><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>This timing waveform represents strobe I\/O.<\/li><li>The sending device, such as a keyboard, outputs a parallel data on the data lines, and then outputs an STB signal to let you know that valid data is present.<\/li><li>For low rates of data transfer, such as from a keyboard to a MP, a simple strobe transfer works well.<\/li><li>However, for higher speed data transfer, this method does not work because there is no signal which tells the sending device when it is safe to send the next data byte.<\/li><li>In other words, the sending system might send data bytes faster than the receiving system could read them.<\/li><li>To prevent this problem, a handshake data transfer scheme is used.<\/li><\/ul>\n\n\n\n<p>Reference(<a rel=\"noreferrer noopener\" href=\"https:\/\/deeprajbhujel.blogspot.com\/2015\/12\/parallel-communication.html\" data-type=\"URL\" data-id=\"https:\/\/deeprajbhujel.blogspot.com\/2015\/12\/parallel-communication.html\" target=\"_blank\">here<\/a>).<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Adding the strobe signal:<\/h2>\n\n\n\n<p>Since the strobe signal is active low (detected when signal is low), we could cheat this by using PWM signal with fixed duty cycle to mimic the strobe signal. <\/p>\n\n\n\n<p>Since we already using timer1 to achieve the communication, we can add an extra pin for PWM.<\/p>\n\n\n\n<p>First, we need to find which pins are responsible for TIM1, from the datasheet of STM32F411, we can find this information in table 9: Alternate function mapping.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"736\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-1024x736.png\" alt=\"\" class=\"wp-image-1979\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-1024x736.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-300x216.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-768x552.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-1536x1103.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-2048x1471.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-1150x826.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-750x539.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-400x287.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-7.55.55-AM-250x180.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The required pin is PA8 and alternate function 1.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Hence, we start off by enabling clock access to GPIOA 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 clock access to GPIOA*\/\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_GPIOAEN;<\/pre><\/div>\n\n\n\n<p>Set PA8 as alternate function:<\/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\/*Set PA8 to AF*\/\n\tGPIOA-&gt;MODER|=GPIO_MODER_MODE8_1;\n\tGPIOA-&gt;MODER&amp;=~GPIO_MODER_MODE8_0;<\/pre><\/div>\n\n\n\n<p>Set which alternate function (AF01 in this case):<\/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\/*Set PA8 to AF1*\/\n\t#define AF01\t\t0x01\n\tGPIOA-&gt;AFR[1]|=(AF01&lt;&lt;GPIO_AFRH_AFSEL8_Pos);<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>In the timer configuration after setting the ARR value, set the CCR1 value to be 100:<\/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;}\">\tTIM1-&gt;CCR1=100;<\/pre><\/div>\n\n\n\n<p>Set channel 1 to be PWM mode 1:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"432\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-1024x432.png\" alt=\"\" class=\"wp-image-1980\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-1024x432.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-300x127.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-768x324.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-1536x648.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-2048x864.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-1150x485.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-750x317.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-400x169.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.07-AM-250x106.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"533\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-1024x533.png\" alt=\"\" class=\"wp-image-1981\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-1024x533.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-300x156.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-768x400.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-1536x800.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-2048x1066.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-1150x599.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-750x391.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-400x208.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.01.50-AM-250x130.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;}\">\tTIM1-&gt;CCMR1|=TIM_CCMR1_OC1M_2|TIM_CCMR1_OC1M_1;<\/pre><\/div>\n\n\n\n<p>Enable Channel1 of the timer:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"249\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-1024x249.png\" alt=\"\" class=\"wp-image-1982\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-1024x249.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-300x73.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-768x187.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-1536x374.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-2048x498.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-1150x280.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-750x182.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-400x97.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.02.57-AM-250x61.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"403\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-1024x403.png\" alt=\"\" class=\"wp-image-1983\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-1024x403.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-300x118.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-768x302.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-1536x604.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-2048x805.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-1150x452.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-750x295.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-400x157.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.03.38-AM-250x98.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;}\">\tTIM1-&gt;CCER|=TIM_CCER_CC1E;<\/pre><\/div>\n\n\n\n<p>Enable main output as following (only for advanced timers):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"550\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-1024x550.png\" alt=\"\" class=\"wp-image-1984\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-1024x550.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-300x161.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-768x413.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-1536x826.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-2048x1101.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-1150x618.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-750x403.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-400x215.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.05.45-AM-250x134.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;}\">\tTIM1-&gt;BDTR|=TIM_BDTR_MOE;<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Hence, the updated 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;stm32f4xx.h&quot;\n#include &quot;stdint.h&quot;\n\n#include &quot;stdlib.h&quot;\n\n#define data_size \t5\n#define CH6 \t\t0x06\n\nuint32_t gpio_pattern[data_size];\n\n\n#define AF01\t\t0x01\n\n\nint main(void)\n{\n\t\/*GPIO Configuration*\/\n\n\t\/*Enable clock access to GPIOA*\/\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_GPIOCEN;\n\n\t\/*Set PC0 to PC7 as output*\/\n\tGPIOC-&gt;MODER|=GPIO_MODER_MODE0_0|GPIO_MODER_MODE1_0|GPIO_MODER_MODE2_0\n\t\t\t|GPIO_MODER_MODE3_0|GPIO_MODER_MODE4_0|GPIO_MODER_MODE5_0|\n\t\t\tGPIO_MODER_MODE6_0|GPIO_MODER_MODE7_0;\n\n\tGPIOC-&gt;MODER&amp;=~(GPIO_MODER_MODE0_1|GPIO_MODER_MODE1_1|GPIO_MODER_MODE2_1\n\t\t\t|GPIO_MODER_MODE3_1|GPIO_MODER_MODE4_1|GPIO_MODER_MODE5_1\n\t\t\t|GPIO_MODER_MODE6_1|GPIO_MODER_MODE7_1);\n\n\n\t\/*PA8 configuration*\/\n\n\t\/*Enable clock access to GPIOA*\/\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_GPIOAEN;\n\n\t\/*Set PA8 to AF*\/\n\tGPIOA-&gt;MODER|=GPIO_MODER_MODE8_1;\n\tGPIOA-&gt;MODER&amp;=~GPIO_MODER_MODE8_0;\n\n\t\/*Set PA8 to AF1*\/\n\n\tGPIOA-&gt;AFR[1]|=(AF01&lt;&lt;GPIO_AFRH_AFSEL8_Pos);\n\n\n\t\/*Timer configuration*\/\n\n\tRCC-&gt;APB2ENR  |=  RCC_APB2ENR_TIM1EN;\n\n\tTIM1-&gt;DIER=TIM_DIER_UDE;\n\n\tTIM1-&gt;PSC=16000-1; \/*16 000 000 \/ 16 000 =1 000*\/\n\tTIM1-&gt;ARR=1000-1; \/*1 000 \/ 1 000 = 10HZ*\/\n\n\tTIM1-&gt;CCR1=100;\n\n\tTIM1-&gt;CCMR1|=TIM_CCMR1_OC1M_2|TIM_CCMR1_OC1M_1;\n\n\tTIM1-&gt;CCER|=TIM_CCER_CC1E;\n\n\tTIM1-&gt;BDTR|=TIM_BDTR_MOE;\n\n\t\/*DMA configuration*\/\n\n\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_DMA2EN;\n\n\tDMA2_Stream5-&gt;CR&amp;=DMA_SxCR_EN;\n\n\twhile((DMA2_Stream5-&gt;CR)&amp;DMA_SxCR_EN){;}\n\n\tDMA2_Stream5-&gt;CR|=(CH6&lt;&lt;DMA_SxCR_CHSEL_Pos)|DMA_SxCR_MSIZE|DMA_SxCR_PSIZE|\n\t\t\tDMA_SxCR_MINC|DMA_SxCR_CIRC|DMA_SxCR_DIR_0;\n\n\tDMA2_Stream5-&gt;NDTR=(uint32_t)data_size;\n\n\tDMA2_Stream5-&gt;PAR=(uint32_t)(&amp;GPIOC-&gt;ODR);\n\n\tDMA2_Stream5-&gt;M0AR=(uint32_t)(gpio_pattern);\n\n\n\t\/*Launch DMA*\/\n\tDMA2_Stream5-&gt;CR|=DMA_SxCR_EN;\n\n\t\/*Launch Timer*\/\n\tTIM1-&gt;CR1     |= TIM_CR1_CEN;\n\n\tsrand (TIM1-&gt;CNT);\n\n\twhile(1)\n\t{\n\t\tfor (int j=0;j&lt;100000;j++);\n\t\t\/*Fill the array with random data*\/\n\t\tfor (int i=0; i&lt;data_size;i++)\n\t\t{\n\t\t\tgpio_pattern[i]=random()%256;\n\t\t}\n\t}\n\n}\n<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Connecting the LED for Strobe Indicator:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>For this, you need extra 1 LED and extra 270Ohm Resistor:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"949\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-1024x949.png\" alt=\"\" class=\"wp-image-1985\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-1024x949.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-300x278.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-768x712.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-1536x1424.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-1150x1066.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-750x695.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-400x371.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM-250x232.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-17-at-8.14.13-AM.png 1700w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Results:<\/h2>\n\n\n\n<p><\/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=\"Emulating parallel Port: Strobe signal\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/liXpsHcMduo?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>Happy coding \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous guide (here), we took a look at what is parallel port and successfully send byte of data using timer and DMA. In this guide, we shall add the strobe signal which will be an essential part in the next part of the guide. In this guide, we shall cover the following: What [&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-1977","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\/1977"}],"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=1977"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1977\/revisions"}],"predecessor-version":[{"id":1986,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1977\/revisions\/1986"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}