{"id":3193,"date":"2025-01-31T04:54:36","date_gmt":"2025-01-31T04:54:36","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=3193"},"modified":"2025-01-31T04:54:38","modified_gmt":"2025-01-31T04:54:38","slug":"getting-started-with-stm32h5-arm-cortex-m33-spi-in-tx-with-dma","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=3193","title":{"rendered":"Getting Started with STM32H5 ARM Cortex M33: SPI in TX with DMA"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/BC39A159-89E3-4307-862B-D8B50AC24300-2.png\" alt=\"\" class=\"wp-image-3194\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/BC39A159-89E3-4307-862B-D8B50AC24300-2.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/BC39A159-89E3-4307-862B-D8B50AC24300-2-300x300.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/BC39A159-89E3-4307-862B-D8B50AC24300-2-150x150.png 150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/BC39A159-89E3-4307-862B-D8B50AC24300-2-768x768.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/BC39A159-89E3-4307-862B-D8B50AC24300-2-750x750.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/BC39A159-89E3-4307-862B-D8B50AC24300-2-400x400.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/BC39A159-89E3-4307-862B-D8B50AC24300-2-250x250.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>In this guide, we shall use DMA to transmit data over SPI bus to relief the CPU and make it free to do something else.<\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Why to use DMA with SPI.<\/li>\n\n\n\n<li>SPI DMA configuration.<\/li>\n\n\n\n<li>Firmware development.<\/li>\n\n\n\n<li>Results.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">1. Why to Use DMA with SPI:<\/h2>\n\n\n\n<p>Using&nbsp;DMA with SPI&nbsp;in STM32 is highly beneficial, especially in applications requiring high-speed communication and reduced CPU load. Here\u2019s why you should use DMA with SPI:<\/p>\n\n\n\n<p>1. Reduced CPU Load<\/p>\n\n\n\n<p>\u2022&nbsp;Without DMA, the CPU must manually&nbsp;read\/write&nbsp;data in an interrupt or polling loop.<\/p>\n\n\n\n<p>\u2022&nbsp;With DMA, the CPU&nbsp;offloads&nbsp;data transfer to the DMA controller, freeing it to handle other tasks.<\/p>\n\n\n\n<p>\u2022&nbsp;Useful in&nbsp;real-time applications&nbsp;like displays (e.g., ILI9341), sensors (e.g., IMU), and data logging.<\/p>\n\n\n\n<p>2. Higher Data Transfer Speed<\/p>\n\n\n\n<p>\u2022&nbsp;SPI is&nbsp;fast&nbsp;(up to tens of MHz), and CPU-driven transfers may not keep up.<\/p>\n\n\n\n<p>\u2022&nbsp;DMA allows&nbsp;continuous, high-speed transfers&nbsp;without gaps caused by CPU delays.<\/p>\n\n\n\n<p>3. Efficient Handling of Large Data Buffers<\/p>\n\n\n\n<p>\u2022&nbsp;SPI is commonly used for&nbsp;large data transactions&nbsp;(e.g., SD cards, TFT screens, ADC\/DAC).<\/p>\n\n\n\n<p>\u2022&nbsp;DMA can&nbsp;transfer entire buffers&nbsp;(e.g., 512-byte SD card blocks) automatically.<\/p>\n\n\n\n<p>4. No Interrupt Overhead<\/p>\n\n\n\n<p>\u2022&nbsp;Without DMA, the CPU must&nbsp;handle an interrupt&nbsp;for each SPI byte\/word.<\/p>\n\n\n\n<p>\u2022&nbsp;With DMA,&nbsp;only one interrupt&nbsp;occurs when the full transfer is complete.<\/p>\n\n\n\n<p>\u2022&nbsp;Reduces&nbsp;latency and power consumption&nbsp;in low-power applications.<\/p>\n\n\n\n<p>5. Bidirectional SPI Transfers<\/p>\n\n\n\n<p>\u2022&nbsp;In&nbsp;full-duplex mode, SPI transmits and receives simultaneously.<\/p>\n\n\n\n<p>\u2022&nbsp;DMA can handle&nbsp;both RX and TX&nbsp;without CPU intervention.<\/p>\n\n\n\n<p>6. Smooth Operation in RTOS-Based Systems<\/p>\n\n\n\n<p>\u2022&nbsp;In FreeRTOS, SPI DMA allows&nbsp;non-blocking communication, letting tasks continue execution.<\/p>\n\n\n\n<p>\u2022&nbsp;Prevents&nbsp;task starvation&nbsp;that would occur with blocking SPI functions.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. SPI DMA Configuration:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>We shall continue from this topic point <a href=\"https:\/\/blog.embeddedexpert.io\/?p=3160\" data-type=\"link\" data-id=\"https:\/\/blog.embeddedexpert.io\/?p=3160\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Open SPI_TX.ioc file as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-1020x1024.jpg\" alt=\"\" class=\"wp-image-3179\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-1020x1024.jpg 1020w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-300x300.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-150x150.jpg 150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-768x771.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-1530x1536.jpg 1530w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-1150x1155.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-750x753.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-400x402.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57-250x250.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-23_07-36-57.jpg 2016w\" sizes=\"(max-width: 1020px) 100vw, 1020px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>From connectivity, select SPI1, the NVIC and enable SPI1 global interrupt as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"918\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-918x1024.jpg\" alt=\"\" class=\"wp-image-3195\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-918x1024.jpg 918w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-269x300.jpg 269w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-768x857.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-1377x1536.jpg 1377w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-1150x1283.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-750x837.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-400x446.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26-250x279.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-31_07-29-26.jpg 1734w\" sizes=\"(max-width: 918px) 100vw, 918px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Then from System Core, select GPDMA1 and enable Ch0 as standard request mode as following:<\/p>\n\n\n\n<p>Configure the CH0 as following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Disable Circular Mode.<\/li>\n\n\n\n<li>Set the request to SPI1_TX\/I2S1_TX.<\/li>\n\n\n\n<li>Priority to low (depending on your application).<\/li>\n\n\n\n<li>Direction Memory to Peripheral.<\/li>\n<\/ul>\n\n\n\n<p>For the source data setting:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Source Address to increment.<\/li>\n\n\n\n<li>Data width to byte.<\/li>\n\n\n\n<li>Keep the rest as default.<\/li>\n<\/ul>\n\n\n\n<p>For the destination data setting:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Disable increment mode.<\/li>\n\n\n\n<li>Data width to byte.<\/li>\n\n\n\n<li>Keep the rest as default.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"928\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-928x1024.jpg\" alt=\"\" class=\"wp-image-3196\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-928x1024.jpg 928w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-272x300.jpg 272w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-768x847.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-1393x1536.jpg 1393w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-1857x2048.jpg 1857w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-1150x1268.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-750x827.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-400x441.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51-250x276.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-01-51.jpg 1922w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Save the project as this will generate the code.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Firmware Development:<\/h2>\n\n\n\n<p>Once the code has been generated, main.c will be opened or open the main.c from the src folder.<\/p>\n\n\n\n<p>In main.c file, in user begin PV section, declare the 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;}\">#define DataSize 5\n\nuint8_t txData[DataSize]={0x00,0x01,0x02,0x03,0x05};\n\nvolatile uint8_t SPI1_TX_Completed=0;<\/pre><\/div>\n\n\n\n<p>The first one is to define the data size, in this example, it is 5 byte.<\/p>\n\n\n\n<p>Buffer to hold the data to be transmitted which its size defined by the define statement.<\/p>\n\n\n\n<p>A volatile flag to handle the transfer completed by SPI.<\/p>\n\n\n\n<p>Next, in user code begin 3 in while 1 loop:<\/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;}\">HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, 0);\nHAL_SPI_Transmit_DMA(&amp;hspi1, txData, DataSize);\nwhile(SPI1_TX_Completed==0);\nSPI1_TX_Completed=0;\nHAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, 1);\nHAL_Delay(1);<\/pre><\/div>\n\n\n\n<p>Set PA6 (which is CS line).<\/p>\n\n\n\n<p>Start the transmission using DMA using the following 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;}\"> HAL_SPI_Transmit_DMA(&amp;hspi1, txData, DataSize);<\/pre><\/div>\n\n\n\n<p>The function takes the following parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Handletypedef for the SPI which is hspi1 in this case.<\/li>\n\n\n\n<li>TxData, the buffer which stores the data to be transmitted.<\/li>\n\n\n\n<li>Data size which is the amount of data to be transmitted.<\/li>\n<\/ul>\n\n\n\n<p>Wait for the TX to be completed then reset flag to 0 and set PA6 to high again and wait 1ms.<\/p>\n\n\n\n<p>Since we already enabled the interrupt for SPI and DMA is enabled by default, there is a function which will be called once the SPI has finished transmitting all the data which can be found here:<\/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;}\">Drivers\/STM32H5xx_HAL_Driver\/Src\/stm32h5xx_hal_spi.c<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"542\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-1024x542.jpg\" alt=\"\" class=\"wp-image-3197\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-1024x542.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-300x159.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-768x406.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-1536x813.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-2048x1084.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-1150x609.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-750x397.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-400x212.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-30_17-08-19-250x132.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>The function is:<\/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 HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)<\/pre><\/div>\n\n\n\n<p>In user code begin 4 of the main.c:<\/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 HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)\n{\n\tif(hspi-&gt;Instance==SPI1)\n\t{\n\t\tSPI1_TX_Completed=1;\n\t}\n\n}<\/pre><\/div>\n\n\n\n<p>Since the function can be called by multiple SPIs, we need to check which SPI is being called 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;}\">if(hspi-&gt;Instance==SPI1)<\/pre><\/div>\n\n\n\n<p>Change according to your SPI.<\/p>\n\n\n\n<p>If it is the needed SPI, set the flag to 1.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Thats all for the Firmware development.<\/p>\n\n\n\n<p>Save the project, build it and run it on your STM32H563Zi board.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/07\/2024-07-12_15-03-3.jpg\" alt=\"\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Results:<\/h2>\n\n\n\n<p>By probing using either logic analyzer or oscilloscope, you should get the following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/IMG_5779.heic\" alt=\"\" class=\"wp-image-3198\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Happy coding \ud83d\ude09<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we shall use DMA to transmit data over SPI bus to relief the CPU and make it free to do something else. In this guide, we shall cover the following: 1. Why to Use DMA with SPI: Using&nbsp;DMA with SPI&nbsp;in STM32 is highly beneficial, especially in applications requiring high-speed communication and reduced [&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-3193","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\/3193"}],"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=3193"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3193\/revisions"}],"predecessor-version":[{"id":3199,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3193\/revisions\/3199"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}