{"id":12977,"date":"2024-06-07T12:22:18","date_gmt":"2024-06-07T09:22:18","guid":{"rendered":"https:\/\/deepbluembedded.com\/?p=12977"},"modified":"2024-06-10T05:18:28","modified_gmt":"2024-06-10T02:18:28","slug":"stm32-uart-half-duplex-single-wire-tutorial-example","status":"publish","type":"post","link":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/","title":{"rendered":"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples"},"content":{"rendered":"\n<p class=\"has-text-align-justify\">In this tutorial, we&#8217;ll discuss how the <strong>STM32 UART Half-Duplex (Single Wire)<\/strong> mode works. You&#8217;ll learn how to use the STM32 UART half-duplex mode to send and receive data over UART with a single wire.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">We&#8217;ll implement an example project for <strong>STM32 UART Half-Duplex Transmitter\/Receiver<\/strong> to practice what we&#8217;ll learn in this tutorial by creating two-way communication between two STM32 board over UART in half-duplex mode. Without further ado, let&#8217;s get right into it!<\/p>\n\n\n<h2 class=\"simpletoc-title\">Table of Contents<\/h2>\n<ol class=\"simpletoc-list\">\n<li><a href=\"#stm32-uart-halfduplex-single-wire-mode\">STM32 UART Half-Duplex (Single Wire) Mode<\/a>\n\n<\/li>\n<li><a href=\"#how-to-send-data-with-stm32-uart-halfduplex\">How To Send Data With STM32 UART Half-Duplex<\/a>\n\n<\/li>\n<li><a href=\"#how-to-receive-data-with-stm32-uart-halfduplex\">How To Receive Data With STM32 UART Half-Duplex<\/a>\n\n<\/li>\n<li><a href=\"#stm32-uart-halfduplex-example-overview\">STM32 UART Half-Duplex Example Overview<\/a>\n\n<\/li>\n<li><a href=\"#stm32-uart-halfduplex-single-wire-example\">STM32 UART Half-Duplex (Single Wire) Example<\/a>\n\n\n<\/li>\n\n<\/li>\n\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-4212f3eb gb-headline-text\" id=\"stm32-uart-halfduplex-single-wire-mode\"><strong>STM32 UART Half-Duplex (Single Wire) Mode<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">The STM32 UART can be configured to operate in half-duplex mode (single wire). In this mode, the UART module can send or receive data using only one wire (line) but not at the same time. It keeps switching between transmitter mode and receiver mode in runtime to achieve this behavior.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">In single-wire half-duplex mode, the TX and RX pins are connected internally. The RX pin is no longer used. The TX pin is always released when no data is transmitted. Thus, it acts as a standard IO in idle or in reception.  This means that the IO must be configured so that TX pin is in alternate-function open-drain mode with an external pull-up resistor. <\/p>\n\n\n\n<p class=\"has-text-align-justify\">The STM32 UART hardware may or may not have this pull-up internally. This should be mentioned in the datasheet of the exact STM32 microcontroller. For the demo example I&#8217;ve created and tested on my hardware, it was necessary to hook up an external pull-up resistor to get it working reliably. A <strong>4.7k\u03a9<\/strong> resistor to <strong>Vcc<\/strong> should be fine for most situations.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-6c68b8cb gb-headline-text\" id=\"how-to-send-data-with-stm32-uart-halfduplex\"><strong>How To Send Data With STM32 UART Half-Duplex<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">To send data in half-duplex mode with STM32 UART, you need first to enable TX using the <code>HAL_HalfDuplex_EnableTransmitter()<\/code> function. Then, you can send the data you want to send over UART in half-duplex mode, and switch back to the RX (receiver) mode to capture any incoming data.<\/p>\n\n\n\n<p>Here is an example code for how this is done using STM32 HAL APIs:<\/p>\n\n\n<pre class=\"lang:c decode:true\">\/\/ Enable TX (Half-Duplex Mode)\nHAL_HalfDuplex_EnableTransmitter(&amp;huart1);\n\n\/\/ Send The Data You Want!\nHAL_UART_Transmit(&amp;huart1, UART1_TxBuffer, UART_TX_BUFFER_SIZE, 100);\n\n\/\/ Switch Back To RX (Receiver Mode)\nHAL_HalfDuplex_EnableReceiver(&amp;huart1);<\/pre>\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-a6ddd5b0 gb-headline-text\" id=\"how-to-receive-data-with-stm32-uart-halfduplex\"><strong>How To Receive Data With STM32 UART Half-Duplex<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">To receive data in half-duplex mode with STM32 UART, you need first to enable RX using the <code>HAL_HalfDuplex_EnableReceiver()<\/code> function. Then, you can receive data over UART in half-duplex mode. It&#8217;s better to use the <strong><a href=\"https:\/\/deepbluembedded.com\/stm32-uart-receive-unknown-length-idle-line-detection-examples\/\" target=\"_blank\" rel=\"noreferrer noopener\">IDLE Line Detection<\/a><\/strong> Receiving scheme to read any unknown number of incoming data bytes and make sure to have the UART interrupt enabled in the NVIC settings.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">Here is an example code for how this is done using STM32 HAL APIs:<\/p>\n\n\n<pre class=\"lang:c decode:true\">int main(void)\n{\n  ...\n  HAL_HalfDuplex_EnableReceiver(&amp;huart1);\n  HAL_UARTEx_ReceiveToIdle_IT(&amp;huart1, UART1_RxBuffer, UART_RX_BUFFER_SIZE);\n  ...\n}\n\nvoid HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)\n{\n  RxDataLen = Size;\n  \/\/ Process The Received Data &amp; Update PWM Outputs\n  ...\n  \/\/ Re-Start The Receive Operation Again\n  HAL_UARTEx_ReceiveToIdle_IT(&amp;huart1, UART1_RxBuffer, UART_RX_BUFFER_SIZE);\n}<\/pre>\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-ec598f2f gb-headline-text\" id=\"stm32-uart-halfduplex-example-overview\"><strong>STM32 UART Half-Duplex Example Overview<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">In the following example project, we&#8217;ll design a two-way communication system between two STM32 microcontrollers using the UART half-duplex single-wire mode.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">In this system, each STM32 microcontroller will do the following functions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Read 2x potentiometers (12-Bit values scaled up to 16-bits)<\/li>\n\n\n\n<li>(every 5ms) Switch the UART to TX mode, send 4-Bytes of data containing the ADC readings of the 2 potentiometers, and switch back to RX mode<\/li>\n\n\n\n<li>When UART data is received with an IDLE line detection event, process the received 4-Bytes of data, and use it to control 2x output PWM LEDs<\/li>\n\n\n\n<li>Keep repeating<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-justify\">In other words, each one of the two STM32 microcontrollers will read its own two potentiometers and send the values to control the other STM32&#8217;s output LEDs brightness (PWM) over the half-duplex UART bus. Each microcontroller is sending and receiving data &#8220;apparently&#8221; at the same time in this system.<\/p>\n\n\n\n<p>Here is the connection diagram for this example project.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-02f2ca20\"><img loading=\"lazy\" decoding=\"async\" width=\"1132\" height=\"841\" class=\"gb-image gb-image-02f2ca20\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-UART-Half-Duplex-Example-Wiring.png\" alt=\"STM32-UART-Half-Duplex-Example-Wiring\" title=\"STM32-UART-Half-Duplex-Example-Wiring\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-UART-Half-Duplex-Example-Wiring.png 1132w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-UART-Half-Duplex-Example-Wiring-300x223.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-UART-Half-Duplex-Example-Wiring-1024x761.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-UART-Half-Duplex-Example-Wiring-768x571.png 768w\" sizes=\"auto, (max-width: 1132px) 100vw, 1132px\" \/><\/figure>\n\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-16f80969 gb-headline-text\" id=\"stm32-uart-halfduplex-single-wire-example\"><strong><strong><strong>STM32 UART Half-Duplex (Single Wire) Example<\/strong><\/strong><\/strong><\/h2>\n\n<div class=\"gb-container gb-container-920db097\">\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong>Step #1<\/strong><\/p>\n\n<\/div>\n\n\n<p class=\"has-text-align-justify\">Open <strong>STM32CubeMX<\/strong>, create a new project, and select the target microcontroller. <\/p>\n\n\n<div class=\"gb-container gb-container-5a1704a8\">\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong>Step #2<\/strong><\/p>\n\n<\/div>\n\n\n<p class=\"has-text-align-justify\">Enable <strong>UART1<\/strong> in <strong>Single-Wire (Half-Duplex)<\/strong> mode and leave the default configurations as is.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-213d5a1f\"><img loading=\"lazy\" decoding=\"async\" width=\"1413\" height=\"585\" class=\"gb-image gb-image-213d5a1f\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Mode-Example-Configuration.png\" alt=\"STM32-Single-Wire-Half-Duplex-Mode-Example-Configuration\" title=\"STM32-Single-Wire-Half-Duplex-Mode-Example-Configuration\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Mode-Example-Configuration.png 1413w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Mode-Example-Configuration-300x124.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Mode-Example-Configuration-1024x424.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Mode-Example-Configuration-768x318.png 768w\" sizes=\"auto, (max-width: 1413px) 100vw, 1413px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Enable The USART1 Global Interrupt From The NVIC Settings Tab<\/strong><\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-e4752197\"><img loading=\"lazy\" decoding=\"async\" width=\"1322\" height=\"669\" class=\"gb-image gb-image-e4752197\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-UART-Receive-DMA-Interrupt-Polling-Example-Tutorial-With-Code.jpg\" alt=\"STM32 UART Receive DMA Interrupt Polling Example Tutorial With Code\" title=\"STM32 UART Receive DMA Interrupt Polling Example Tutorial With Code\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-UART-Receive-DMA-Interrupt-Polling-Example-Tutorial-With-Code.jpg 1322w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-UART-Receive-DMA-Interrupt-Polling-Example-Tutorial-With-Code-300x152.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-UART-Receive-DMA-Interrupt-Polling-Example-Tutorial-With-Code-1024x518.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-UART-Receive-DMA-Interrupt-Polling-Example-Tutorial-With-Code-768x389.jpg 768w\" sizes=\"auto, (max-width: 1322px) 100vw, 1322px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n<div class=\"gb-container gb-container-89f384e3\">\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong>Step #3<\/strong><\/p>\n\n<\/div>\n\n\n<p>Enable the <strong>ADC<\/strong> channels: <strong>CH8<\/strong> &amp; <strong>CH9<\/strong><\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-b47e4c82\"><img loading=\"lazy\" decoding=\"async\" width=\"1638\" height=\"752\" class=\"gb-image gb-image-b47e4c82\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-ADC-Configuration.png\" alt=\"STM32-Single-Wire-Half-Duplex-Example-ADC-Configuration\" title=\"STM32-Single-Wire-Half-Duplex-Example-ADC-Configuration\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-ADC-Configuration.png 1638w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-ADC-Configuration-300x138.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-ADC-Configuration-1024x470.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-ADC-Configuration-768x353.png 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-ADC-Configuration-1536x705.png 1536w\" sizes=\"auto, (max-width: 1638px) 100vw, 1638px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n<div class=\"gb-container gb-container-334763e6\">\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong>Step #4<\/strong><\/p>\n\n<\/div>\n\n\n<p>Configure <strong>Timer3<\/strong> to generate 2x <strong>PWM<\/strong> outputs on <strong>CH1<\/strong> &amp; <strong>CH2<\/strong> with default configurations as shown below.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-0353179d\"><img loading=\"lazy\" decoding=\"async\" width=\"1642\" height=\"832\" class=\"gb-image gb-image-0353179d\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-PWM-Configuration.png\" alt=\"STM32-Single-Wire-Half-Duplex-Example-PWM-Configuration\" title=\"STM32-Single-Wire-Half-Duplex-Example-PWM-Configuration\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-PWM-Configuration.png 1642w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-PWM-Configuration-300x152.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-PWM-Configuration-1024x519.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-PWM-Configuration-768x389.png 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-PWM-Configuration-1536x778.png 1536w\" sizes=\"auto, (max-width: 1642px) 100vw, 1642px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n<div class=\"gb-container gb-container-05485edc\">\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong>Step #5<\/strong><\/p>\n\n<\/div>\n\n\n<p>Configure <strong>Timer2<\/strong> to generate an <strong>interrupt<\/strong> every <strong>5ms<\/strong> using the configurations shown below. I&#8217;ve used this <strong><a href=\"https:\/\/deepbluembedded.com\/stm32-timer-calculator\/\" target=\"_blank\" rel=\"noreferrer noopener\">STM32 Timer Calculator<\/a><\/strong> to get these values.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-b400fef5\"><img loading=\"lazy\" decoding=\"async\" width=\"747\" height=\"502\" class=\"gb-image gb-image-b400fef5\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-Timer-Configuration.png\" alt=\"\" title=\"STM32-Single-Wire-Half-Duplex-Example-Timer-Configuration\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-Timer-Configuration.png 747w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-Single-Wire-Half-Duplex-Example-Timer-Configuration-300x202.png 300w\" sizes=\"auto, (max-width: 747px) 100vw, 747px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n<div class=\"gb-container gb-container-8b3b0e8f\">\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong>Step #6<\/strong><\/p>\n\n<\/div>\n\n\n<p>Go to the <strong>RCC<\/strong> clock configuration page and enable the <strong>HSE external crystal oscillator<\/strong> input.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-88ceabc4\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"682\" class=\"gb-image gb-image-88ceabc4\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2020\/06\/STM32-RCC-External-Clock-Selection-CubeMX.png\" alt=\"STM32 RCC External Clock Selection CubeMX\" title=\"STM32 RCC External Clock Selection CubeMX\" 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\n\n\n<p><\/p>\n\n\n<div class=\"gb-container gb-container-e36f220d\">\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong>Step #7<\/strong><\/p>\n\n<\/div>\n\n\n<p class=\"has-text-align-justify\">Go to the clock configurations page, and select the <strong>HSE<\/strong> as a clock source, <strong>PLL<\/strong> output, and type in <strong>72<\/strong>MHz for the desired output system frequency. Hit the &#8220;<code>Enter<\/code>&#8221; key, and let the application solve for the required PLL dividers\/multipliers to achieve the desired clock rate.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-bbf9e94e\"><img loading=\"lazy\" decoding=\"async\" width=\"1410\" height=\"679\" class=\"gb-image gb-image-bbf9e94e\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-Blue-Pill-Proteus-Library-Simulation-Clock-Configuration.png\" alt=\"STM32-Blue-Pill-Proteus-Library-Simulation-Clock-Configuration\" title=\"STM32-Blue-Pill-Proteus-Library-Simulation-Clock-Configuration\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-Blue-Pill-Proteus-Library-Simulation-Clock-Configuration.png 1410w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-Blue-Pill-Proteus-Library-Simulation-Clock-Configuration-300x144.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-Blue-Pill-Proteus-Library-Simulation-Clock-Configuration-1024x493.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/STM32-Blue-Pill-Proteus-Library-Simulation-Clock-Configuration-768x370.png 768w\" sizes=\"auto, (max-width: 1410px) 100vw, 1410px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n<div class=\"gb-container gb-container-34878c4a\">\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong>Step #8<\/strong><\/p>\n\n<\/div>\n\n\n<p>Name &amp; Generate The Project Initialization Code For CubeIDE or The IDE You&#8217;re Using.<\/p>\n\n\n<h3 class=\"gb-headline gb-headline-a204d28e gb-headline-text\" id=\"stm32-uart-halfduplex-txrx-example-code\"><strong>STM32 UART Half-Duplex Tx\/Rx Example Code<\/strong><\/h3>\n\n\n<p><span style=\"color: #333399; font-size: 14pt;\"><strong>Here is The Application Code For This LAB (main.c)<\/strong><\/span><\/p>\n\n\n<pre class=\"lang:c decode:true \">\/*\n * LAB Name: STM32 UART Single-Wire (Half-Duplex) TxRx Example\n * Author: Khaled Magdy\n * For More Info Visit: www.DeepBlueMbedded.com\n*\/\n#include \"main.h\"\n\n#define UART_RX_BUFFER_SIZE  40\n#define UART_TX_BUFFER_SIZE  4\n\nADC_HandleTypeDef hadc1;\nTIM_HandleTypeDef htim2;\nTIM_HandleTypeDef htim3;\nUART_HandleTypeDef huart1;\n\nuint16_t i = 0, AD_RES[2];\nADC_ChannelConfTypeDef ADC_CH_Cfg = {0};\nuint32_t ADC_Channels[2] = {ADC_CHANNEL_8, ADC_CHANNEL_9};\nuint8_t UART1_RxBuffer[UART_RX_BUFFER_SIZE] = {0};\nuint8_t UART1_TxBuffer[UART_TX_BUFFER_SIZE] = {0};\nuint16_t RxDataLen = 0;\n\nvoid SystemClock_Config(void);\nstatic void MX_GPIO_Init(void);\nstatic void MX_ADC1_Init(void);\nstatic void MX_TIM2_Init(void);\nstatic void MX_TIM3_Init(void);\nstatic void MX_USART1_UART_Init(void);\n\nint main(void)\n{\n  HAL_Init();\n  SystemClock_Config();\n  MX_GPIO_Init();\n  MX_ADC1_Init();\n  MX_TIM2_Init();\n  MX_TIM3_Init();\n  MX_USART1_UART_Init();\n  HAL_TIM_Base_Start_IT(&amp;htim2);\n  HAL_TIM_PWM_Start(&amp;htim3, TIM_CHANNEL_1);\n  HAL_TIM_PWM_Start(&amp;htim3, TIM_CHANNEL_2);\n  HAL_HalfDuplex_EnableReceiver(&amp;huart1);\n  HAL_UARTEx_ReceiveToIdle_IT(&amp;huart1, UART1_RxBuffer, UART_RX_BUFFER_SIZE);\n  ADC_CH_Cfg.Rank =  ADC_REGULAR_RANK_1;\n  ADC_CH_Cfg.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;\n\n  while (1)\n  {\n\t  for(i=0; i&lt;2; i++) \/\/ Read The Potentiometers\n\t  {\n\t\t  ADC_CH_Cfg.Channel = ADC_Channels[i];         \/\/ Select The ADC Channel [i]\n\t\t  HAL_ADC_ConfigChannel(&amp;hadc1, &amp;ADC_CH_Cfg);   \/\/ Configure The Selected ADC Channel\n\t\t  HAL_ADC_Start(&amp;hadc1);                        \/\/ Start ADC Conversion @ Selected Channel\n\t\t  HAL_ADC_PollForConversion(&amp;hadc1, 1);         \/\/ Poll The ADC Channel With TimeOut = 1mSec\n\t\t  AD_RES[i] = (HAL_ADC_GetValue(&amp;hadc1) &lt;&lt; 4);  \/\/ Read The ADC Conversion Result\n\t  }\n\t  HAL_Delay(1);\n  }\n}\n\nvoid HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)\n{\n    if(htim-&gt;Instance == TIM2)\n    {\n    \t\/\/ Pack The ADC Results into UART1_TxBuffer &amp; Send it Over UART\n    \tUART1_TxBuffer[0] = (uint8_t)(AD_RES[0] &amp; 0xFF);         \/\/ Lower byte of AD_RES[0]\n    \tUART1_TxBuffer[1] = (uint8_t)((AD_RES[0] &gt;&gt; 8) &amp; 0xFF);  \/\/ Upper byte of AD_RES[0]\n    \tUART1_TxBuffer[2] = (uint8_t)(AD_RES[1] &amp; 0xFF);         \/\/ Lower byte of AD_RES[1]\n    \tUART1_TxBuffer[3] = (uint8_t)((AD_RES[1] &gt;&gt; 8) &amp; 0xFF);  \/\/ Upper byte of AD_RES[1]\n    \tHAL_HalfDuplex_EnableTransmitter(&amp;huart1);\n    \tHAL_UART_Transmit(&amp;huart1, UART1_TxBuffer, UART_TX_BUFFER_SIZE, 1000);\n    \t\/\/ Switch Back To Receiver Mode\n    \tHAL_HalfDuplex_EnableReceiver(&amp;huart1);\n    }\n}\n\nvoid HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)\n{\n\tRxDataLen = Size;\n\t\/\/ Process The Received Data &amp; Update PWM Outputs\n\tif(RxDataLen == UART_TX_BUFFER_SIZE)\n\t{\n\t\tTIM3-&gt;CCR1 = (uint16_t)UART1_RxBuffer[0] | ((uint16_t)UART1_RxBuffer[1] &lt;&lt; 8);\n\t\tTIM3-&gt;CCR2 = (uint16_t)UART1_RxBuffer[2] | ((uint16_t)UART1_RxBuffer[3] &lt;&lt; 8);\n\t}\n\t\/\/ Re-Start The Receive Operation Again\n\tHAL_UARTEx_ReceiveToIdle_IT(&amp;huart1, UART1_RxBuffer, UART_RX_BUFFER_SIZE);\n}<\/pre>\n\n\n<p><\/p>\n\n\n<h3 class=\"gb-headline gb-headline-14995b2e gb-headline-text\" id=\"code-explanation\"><strong><strong><strong>Code Explanation<\/strong><\/strong><\/strong><\/h3>\n\n\n<p class=\"has-text-align-justify\">In the <code>main()<\/code> function, we Call the <code>HAL_UARTEx_ReceiveToIdle_IT()<\/code> to start the reception of UART data in the <code>UART1_RxBuffer<\/code> using IDLE line detection in interrupt mode.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">In the <code>while(1)<\/code> super loop, we keep sampling the 2x ADC channels to get the potentiometers readings using <strong><a href=\"https:\/\/deepbluembedded.com\/stm32-adc-channel-select-multi-channel-without-dma\/\" target=\"_blank\" rel=\"noreferrer noopener\">This ADC Multi-Channel Sampling Technique<\/a><\/strong> and store the results in this <code>AD_RES[]<\/code> buffer array.<\/p>\n\n\n\n<p class=\"has-text-align-justify\"><strong>Every 5ms<\/strong>, a Timer2 interrupt is fired and the CPU starts executing the <code>HAL_TIM_PeriodElapsedCallback()<\/code> ISR handler function. In which it does the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pack the ADC readings into the <code>UART1_TxBuffer<\/code> array.<\/li>\n\n\n\n<li>Switch the UART mode from receiver to transmitter<\/li>\n\n\n\n<li>Transmit the <code>UART1_TxBuffer<\/code> data<\/li>\n\n\n\n<li>Switch back to UART receiver mode<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-justify\">The Rx interrupt is fired and the ISR function <code>HAL_UARTEx_RxEventCallback()<\/code> is called whenever the hardware detects an IDLE event <strong>or<\/strong> we&#8217;ve already received the maximum buffer length of data <code>UART_RX_BUFFER_SIZE<\/code>. In the ISR Callback function:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Save the received data length (size) into the <code>RxDataLen<\/code> variable<\/li>\n\n\n\n<li>Process the received data (ADC readings) and reconstruct the original value of each reading<\/li>\n\n\n\n<li>Update the PWM output duty cycle according to the received ADC readings<\/li>\n\n\n\n<li>Re-start the UART data reception with IDLE line detection in interrupt mode again, and so on&#8230;<\/li>\n<\/ul>\n\n\n<h3 class=\"gb-headline gb-headline-c7512d43 gb-headline-text\" id=\"stm32-uart-single-wire-txrx-example-testing\"><strong>STM32 UART Single Wire Tx\/Rx Example Testing<\/strong><\/h3>\n\n\n<p class=\"has-text-align-justify\">This is the testing result for this example project on my two STM32 blue pill boards (F103C6T6). Note how each board&#8217;s potentiometers control the other&#8217;s LEDs brightness which verifies that the two-way communication is properly established.<\/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 UART Half Duplex Single Wire Example Demo\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/kn_sb-gfOds?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 class=\"has-text-align-justify\"><\/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 STM32 Examples<\/strong><\/p>\n\n\n\n<p>All the example Code\/LABs\/Projects in this STM32 Series of Tutorials are done using the Dev boards &amp; Electronic Parts Below:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>QTY.<\/strong><\/td><td><strong>Component Name<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Amazon.com<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>AliExpress<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>eBay<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong>STM32-F103 BluePill Board (ARM Cortex-M3 @ 72MHz)<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/3dmciNJ\" target=\"_blank\" rel=\"noreferrer noopener\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/s.click.aliexpress.com\/e\/_DlKiyXX\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><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=\"noreferrer noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong>Nucleo-L432KC (ARM Cortex-M4 @ 80MHz)<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/3ckK9Fv\" target=\"_blank\" rel=\"noreferrer noopener\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/s.click.aliexpress.com\/e\/_DD8Y9Ev\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><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=\"noreferrer noopener\">eBay<\/a><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong>ST-Link V2 Debugger<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/2Awd8bW\" target=\"_blank\" rel=\"noreferrer noopener\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/s.click.aliexpress.com\/e\/_DCGaXVJ\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><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=\"noreferrer noopener\">eBay<\/a><\/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:\/\/s.click.aliexpress.com\/e\/_DB6akVT\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/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> &amp;&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:\/\/s.click.aliexpress.com\/e\/_DCWTYWN\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/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> &amp;&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:\/\/s.click.aliexpress.com\/e\/_DDFdSuv\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/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> &amp;&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:\/\/s.click.aliexpress.com\/e\/_Dlk5NNX\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/a> &amp; <a href=\"https:\/\/s.click.aliexpress.com\/e\/_DErceEd\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/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\">1<\/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> &amp;&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:\/\/s.click.aliexpress.com\/e\/_DFaA5Jb\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/a> &amp; <a href=\"https:\/\/s.click.aliexpress.com\/e\/_DBIWX7T\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/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;\">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> &amp;&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:\/\/s.click.aliexpress.com\/e\/_DkCOL85\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/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><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td><strong>Potentiometers<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/amzn.to\/41HW9fn\" target=\"_blank\" rel=\"noreferrer noopener\">Amazon<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/s.click.aliexpress.com\/e\/_DlgALGd\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/a><\/td><td class=\"has-text-align-center\" data-align=\"center\"><a href=\"https:\/\/ebay.us\/z3JSIV\" target=\"_blank\" rel=\"noreferrer 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:\/\/s.click.aliexpress.com\/e\/_Dd6BvIt\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/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><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"has-text-align-center\">\u2605 Check The Links Below For The Full Course Kit List &amp; LAB Test Equipment Required For Debugging \u2605<\/p>\n\n\n<div class=\"gb-container gb-container-89b83f7d\">\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<\/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 our 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 the whole 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\/1UV8r-wl3KAo7YYoqCgH_oYZbx-h1pmIV\/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-83568927 gb-headline-text\" id=\"wrap-up\"><strong>Wrap Up<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">In conclusion, we&#8217;ve explored how to set up the STM32 UART in Half-Duplex mode to transmit and receive data on the same line (wire) and we&#8217;ve established a 2-way communication between 2 STM32 boards using UART half-duplex mode. You can build on top of the example provided in this tutorial and\/or explore the other parts of this STM32 UART tutorial series linked below.<\/p>\n\n\n<div class=\"gb-headline gb-headline-754c4013 gb-headline-text\" id=\"mptt\">This Tutorial is Part of The Following Multi-Part Tutorial Series:<\/div>\n\n<div class=\"gb-container gb-container-5793f567 has-shadow\">\n<div class=\"gb-grid-wrapper gb-grid-wrapper-4468ba3f\">\n<div class=\"gb-grid-column gb-grid-column-cc7bfc61\"><div class=\"gb-container gb-container-cc7bfc61\">\n<div class=\"gb-container gb-container-4fa6ba32 has-shadow\">\n<div class=\"gb-headline gb-headline-28d60068 gb-headline-text\"><a href=\"https:\/\/deepbluembedded.com\/stm32-usart-uart-tutorial\/\">(1) STM32 UART Tutorial<\/a><\/div>\n\n\n<figure class=\"gb-block-image gb-block-image-0387fba7\"><a href=\"https:\/\/deepbluembedded.com\/stm32-usart-uart-tutorial\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" class=\"gb-image gb-image-0387fba7\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial.jpg\" alt=\"STM32-UART-USART-Tutorial\" title=\"STM32-UART-USART-Tutorial\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial.jpg 1280w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial-768x432.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/figure>\n\n<\/div>\n\n<div class=\"gb-container gb-container-84339b02 has-shadow\">\n<div class=\"gb-headline gb-headline-f725f239 gb-headline-text\"><a href=\"https:\/\/deepbluembedded.com\/stm32-uart-dma-receive-transmit-rx-tx-examples\/\">(5) STM32 UART DMA<\/a><\/div>\n\n\n<figure class=\"gb-block-image gb-block-image-cec7f055\"><a href=\"https:\/\/deepbluembedded.com\/stm32-uart-dma-receive-transmit-rx-tx-examples\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" class=\"gb-image gb-image-cec7f055\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples.jpg\" alt=\"STM32 UART DMA (Receive Transmit + DMA) Rx Tx Examples\" title=\"STM32 UART DMA (Receive Transmit + DMA) Rx Tx Examples\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples.jpg 1280w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples-768x432.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/figure>\n\n<\/div>\n<\/div><\/div>\n\n<div class=\"gb-grid-column gb-grid-column-7fa3301d\"><div class=\"gb-container gb-container-7fa3301d\">\n<div class=\"gb-container gb-container-c60a2915 has-shadow\">\n<div class=\"gb-headline gb-headline-ee3b9efa gb-headline-text\"><a href=\"https:\/\/deepbluembedded.com\/stm32-debugging-with-uart-serial-print\/\">(2) UART Serial Print Debugging<\/a><\/div>\n\n\n<figure class=\"gb-block-image gb-block-image-e2a0eeaa\"><a href=\"https:\/\/deepbluembedded.com\/stm32-debugging-with-uart-serial-print\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" class=\"gb-image gb-image-e2a0eeaa\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging.jpg\" alt=\"STM32-UART-Serial-Print-Debugging\" title=\"STM32-UART-Serial-Print-Debugging\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging.jpg 1280w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging-768x432.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/figure>\n\n<\/div>\n\n<div class=\"gb-container gb-container-e4673292 has-shadow\">\n<div class=\"gb-headline gb-headline-19cd8454 gb-headline-text\"><a href=\"https:\/\/deepbluembedded.com\/stm32-uart-receive-unknown-length-idle-line-detection-examples\/\">(6) UART Receive Unknown Length (IDLE Line Detection)<\/a><\/div>\n\n\n<figure class=\"gb-block-image gb-block-image-03274f28\"><a href=\"https:\/\/deepbluembedded.com\/stm32-uart-receive-unknown-length-idle-line-detection-examples\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" class=\"gb-image gb-image-03274f28\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Unknown-Length-IDLE-Line-Detection.jpg\" alt=\"STM32-UART-Receive-Unknown-Length-IDLE-Line-Detection\" title=\"STM32-UART-Receive-Unknown-Length-IDLE-Line-Detection\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Unknown-Length-IDLE-Line-Detection.jpg 1280w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Unknown-Length-IDLE-Line-Detection-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Unknown-Length-IDLE-Line-Detection-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Unknown-Length-IDLE-Line-Detection-768x432.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/figure>\n\n<\/div>\n<\/div><\/div>\n\n<div class=\"gb-grid-column gb-grid-column-cbab459f\"><div class=\"gb-container gb-container-cbab459f\">\n<div class=\"gb-container gb-container-81e8309a has-shadow\">\n<div class=\"gb-headline gb-headline-e856a24a gb-headline-text\"><a href=\"https:\/\/deepbluembedded.com\/stm32-serial-port-uart-with-usb-ttl-converter-pc-interfacing\/\">(3) UART With USB-TTL Converter<\/a><\/div>\n\n\n<figure class=\"gb-block-image gb-block-image-ee7b889c\"><a href=\"https:\/\/deepbluembedded.com\/stm32-serial-port-uart-with-usb-ttl-converter-pc-interfacing\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" class=\"gb-image gb-image-ee7b889c\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter.jpg\" alt=\"STM32-UART-USB-TTL-Converter\" title=\"STM32-UART-USB-TTL-Converter\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter.jpg 1280w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter-768x432.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/figure>\n\n<\/div>\n\n<div class=\"gb-container gb-container-92dfb1b0 has-shadow\">\n<div class=\"gb-headline gb-headline-5c886df2 gb-headline-text\">(7) UART Single-Wire (Half-Duplex) Tutorial &amp; Examples<\/div>\n\n\n<figure class=\"gb-block-image gb-block-image-7470103d\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" class=\"gb-image gb-image-7470103d\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg\" alt=\"STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples\" title=\"STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg 1280w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples-768x432.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/figure>\n\n<\/div>\n<\/div><\/div>\n\n<div class=\"gb-grid-column gb-grid-column-a7f23caa\"><div class=\"gb-container gb-container-a7f23caa\">\n<div class=\"gb-container gb-container-efd41f18 has-shadow\">\n<div class=\"gb-headline gb-headline-9284c9a4 gb-headline-text\"><a href=\"https:\/\/deepbluembedded.com\/how-to-receive-uart-serial-data-with-stm32-dma-interrupt-polling\/\">(4) UART Rx\/Tx (Polling, Interrupt, DMA)<\/a><\/div>\n\n\n<figure class=\"gb-block-image gb-block-image-2f06ef8b\"><a href=\"https:\/\/deepbluembedded.com\/how-to-receive-uart-serial-data-with-stm32-dma-interrupt-polling\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" class=\"gb-image gb-image-2f06ef8b\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA.jpg\" alt=\"STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA\" title=\"STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA.jpg 1280w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA-768x432.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/figure>\n\n<\/div>\n\n<div class=\"gb-container gb-container-c1414534 has-shadow\">\n<div class=\"gb-headline gb-headline-2e06b528 gb-headline-text\">(8) STM32 UART Multi-Processor Communication<\/div>\n\n\n<figure class=\"gb-block-image gb-block-image-9cc4167c\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" class=\"gb-image gb-image-9cc4167c\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Multiprocessor-Communication.jpg\" alt=\"STM32-UART-Multiprocessor-Communication\" title=\"STM32-UART-Multiprocessor-Communication\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Multiprocessor-Communication.jpg 1280w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Multiprocessor-Communication-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Multiprocessor-Communication-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Multiprocessor-Communication-768x432.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/figure>\n\n<\/div>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p> &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples\" class=\"read-more button\" href=\"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/#more-12977\" aria-label=\"Read more about STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":12748,"comment_status":"open","ping_status":"open","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":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28,30,103],"tags":[322],"class_list":["post-12977","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-embedded-systems","category-embedded-tutorials","category-stm32-arm","tag-stm32-serial-communication","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 UART Half-Duplex (Single Wire) Tutorial &amp; Examples<\/title>\n<meta name=\"description\" content=\"UART Half-Duplex (Single Wire) Tutorial Code Examples. How To Send\/Receive Data With STM32 UART in Single Wire (Half-Duplex) Unknown Length\" \/>\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-uart-half-duplex-single-wire-tutorial-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples\" \/>\n<meta property=\"og:description\" content=\"UART Half-Duplex (Single Wire) Tutorial Code Examples. How To Send\/Receive Data With STM32 UART in Single Wire (Half-Duplex) Unknown Length\" \/>\n<meta property=\"og:url\" content=\"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/\" \/>\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=\"2024-06-07T09:22:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-10T02:18:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\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-uart-half-duplex-single-wire-tutorial-example\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/\"},\"author\":{\"name\":\"Khaled Magdy\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"headline\":\"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples\",\"datePublished\":\"2024-06-07T09:22:18+00:00\",\"dateModified\":\"2024-06-10T02:18:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/\"},\"wordCount\":1328,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"image\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg\",\"keywords\":[\"STM32 Serial Communication\"],\"articleSection\":[\"Embedded Systems\",\"Embedded Tutorials\",\"STM32 ARM\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/\",\"name\":\"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg\",\"datePublished\":\"2024-06-07T09:22:18+00:00\",\"dateModified\":\"2024-06-10T02:18:28+00:00\",\"description\":\"UART Half-Duplex (Single Wire) Tutorial Code Examples. How To Send\\\/Receive Data With STM32 UART in Single Wire (Half-Duplex) Unknown Length\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/#primaryimage\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg\",\"contentUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg\",\"width\":1280,\"height\":720,\"caption\":\"STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/stm32-uart-half-duplex-single-wire-tutorial-example\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/deepbluembedded.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples\"}]},{\"@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 UART Half-Duplex (Single Wire) Tutorial &amp; Examples","description":"UART Half-Duplex (Single Wire) Tutorial Code Examples. How To Send\/Receive Data With STM32 UART in Single Wire (Half-Duplex) Unknown Length","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-uart-half-duplex-single-wire-tutorial-example\/","og_locale":"en_US","og_type":"article","og_title":"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples","og_description":"UART Half-Duplex (Single Wire) Tutorial Code Examples. How To Send\/Receive Data With STM32 UART in Single Wire (Half-Duplex) Unknown Length","og_url":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/","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":"2024-06-07T09:22:18+00:00","article_modified_time":"2024-06-10T02:18:28+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.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-uart-half-duplex-single-wire-tutorial-example\/#article","isPartOf":{"@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/"},"author":{"name":"Khaled Magdy","@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"headline":"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples","datePublished":"2024-06-07T09:22:18+00:00","dateModified":"2024-06-10T02:18:28+00:00","mainEntityOfPage":{"@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/"},"wordCount":1328,"commentCount":0,"publisher":{"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"image":{"@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/#primaryimage"},"thumbnailUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg","keywords":["STM32 Serial Communication"],"articleSection":["Embedded Systems","Embedded Tutorials","STM32 ARM"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/","url":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/","name":"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples","isPartOf":{"@id":"https:\/\/deepbluembedded.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/#primaryimage"},"image":{"@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/#primaryimage"},"thumbnailUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg","datePublished":"2024-06-07T09:22:18+00:00","dateModified":"2024-06-10T02:18:28+00:00","description":"UART Half-Duplex (Single Wire) Tutorial Code Examples. How To Send\/Receive Data With STM32 UART in Single Wire (Half-Duplex) Unknown Length","breadcrumb":{"@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/#primaryimage","url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg","contentUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg","width":1280,"height":720,"caption":"STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples"},{"@type":"BreadcrumbList","@id":"https:\/\/deepbluembedded.com\/stm32-uart-half-duplex-single-wire-tutorial-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/deepbluembedded.com\/"},{"@type":"ListItem","position":2,"name":"STM32 UART Half-Duplex (Single Wire) Tutorial &amp; Examples"}]},{"@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\/2024\/04\/STM32-UART-Single-Wire-Half-Duplex-Tutorial-Examples.jpg","jetpack_shortlink":"https:\/\/wp.me\/p9SirL-3nj","jetpack-related-posts":[{"id":13016,"url":"https:\/\/deepbluembedded.com\/stm32-1-wire-one-wire-protocol-ds18b20-code-example\/","url_meta":{"origin":12977,"position":0},"title":"STM32 1-Wire (One Wire) Protocol + DS18B20 Code Example","author":"Khaled Magdy","date":"June 11, 2024","format":false,"excerpt":"In this tutorial, we'll discuss how to implement STM32 1-Wire (One Wire) Protocol Communication using the STM32 UART (Single-Wire \/ Half-Duplex) Mode. You'll learn how to use the STM32 UART in Single-Wire mode to interface the DS18B20 Temperature Sensor With STM32 over 1-Wire communication. Without further ado, let's get right\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32 1-Wire (One Wire) Protocol + DS18B20 Code Example","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-1-Wire-One-Wire-Protocol-DS18B20-Code-Example.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-1-Wire-One-Wire-Protocol-DS18B20-Code-Example.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-1-Wire-One-Wire-Protocol-DS18B20-Code-Example.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-1-Wire-One-Wire-Protocol-DS18B20-Code-Example.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/06\/STM32-1-Wire-One-Wire-Protocol-DS18B20-Code-Example.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":4426,"url":"https:\/\/deepbluembedded.com\/stm32-usart-uart-tutorial\/","url_meta":{"origin":12977,"position":1},"title":"STM32 UART (USART) Tutorial + Examples (DMA, Interrupt)","author":"Khaled Magdy","date":"June 13, 2020","format":false,"excerpt":"In this tutorial, we'll discuss the STM32 UART Communication. You'll learn how to use and configure the STM32 UART To Send\/Receive Serial Data in polling, interrupt, and DMA modes. We'll also implement a couple of STM32 UART Example Projects to practice what we'll learn in this tutorial. Without further ado,\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32-UART-USART-Tutorial","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USART-Tutorial.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":4772,"url":"https:\/\/deepbluembedded.com\/how-to-receive-uart-serial-data-with-stm32-dma-interrupt-polling\/","url_meta":{"origin":12977,"position":2},"title":"STM32 UART Interrupt, DMA, Polling | UART Receive Examples","author":"Khaled Magdy","date":"June 26, 2020","format":false,"excerpt":"In this tutorial, I'll briefly list down the different ways to receive UART data in STM32 microcontrollers. Starting with the least efficient way which is polling for the UART peripheral received data, then we'll see the interrupt-driven reception method which involves the CPU intervention but it's non-blocking anyway. And lastly,\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Receive-Transmit-Rx-Tx-Examples-Polling-Interrupt-DMA.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":4512,"url":"https:\/\/deepbluembedded.com\/stm32-serial-port-uart-with-usb-ttl-converter-pc-interfacing\/","url_meta":{"origin":12977,"position":3},"title":"STM32 Serial Communication With PC (STM32 UART To USB)","author":"Khaled Magdy","date":"June 17, 2020","format":false,"excerpt":"In this tutorial, we'll create an STM32 Serial Communication With PC example project. Using an STM32 With UART To USB TLL converter chip to send serial data from the STM32 microcontroller to the PC over UART. Without further ado, let's get right into it! STM32 Serial Communication With PC Example\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32-UART-USB-TTL-Converter","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-USB-TTL-Converter.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":12737,"url":"https:\/\/deepbluembedded.com\/stm32-uart-dma-receive-transmit-rx-tx-examples\/","url_meta":{"origin":12977,"position":4},"title":"STM32 UART DMA (Receive\/Transmit + DMA) Rx\/Tx Examples","author":"Khaled Magdy","date":"April 20, 2024","format":false,"excerpt":"In this tutorial, we'll discuss the STM32 UART DMA Mode (Receive\/Transmit). Using the STM32 UART DMA mode is a significantly more efficient way of transmitting\/receiving data over UART while keeping the CPU not loaded most of the time. We'll implement an STM32 UART DMA Rx\/Tx Example project to practice what\u2026","rel":"","context":"In &quot;Embedded Systems&quot;","block_context":{"text":"Embedded Systems","link":"https:\/\/deepbluembedded.com\/embedded-systems\/"},"img":{"alt_text":"STM32 UART DMA (Receive Transmit + DMA) Rx Tx Examples","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-DMA-Receive-Transmit-DMA-Rx-Tx-Examples.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":4476,"url":"https:\/\/deepbluembedded.com\/stm32-debugging-with-uart-serial-print\/","url_meta":{"origin":12977,"position":5},"title":"STM32 Serial Print &amp; Monitor (UART Data Debug)","author":"Khaled Magdy","date":"June 14, 2020","format":false,"excerpt":"In this tutorial, we'll discuss implementing an STM32 Serial Print using UART and display the debug data on STM32CubeIDE Serial Monitor & Serial Terminal on a PC using a USB-TLL Converter. We'll perform the STM32 serial print examples using the STM32 Blue Pill board and the Nucleo32-L432KC board. As we've\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\/2024\/04\/STM32-UART-Serial-Print-Debugging.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/04\/STM32-UART-Serial-Print-Debugging.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/12977","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=12977"}],"version-history":[{"count":19,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/12977\/revisions"}],"predecessor-version":[{"id":13020,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/12977\/revisions\/13020"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/media\/12748"}],"wp:attachment":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/media?parent=12977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/categories?post=12977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/tags?post=12977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}