{"id":6275,"date":"2021-06-04T10:02:28","date_gmt":"2021-06-04T10:02:28","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=6275"},"modified":"2023-09-04T10:48:58","modified_gmt":"2023-09-04T05:18:58","slug":"freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/","title":{"rendered":"FreeRTOS Lecture 37 &#8211; Exercise: UART Printmsg implementation using std periph. library"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\" style=\"text-align: left;\">\n<h1 class=\"\" style=\"text-align: center; font-size: 32px; border-width: 0px; line-height: 50px;\"><span style=\"color: #000080;\">Exercise: UART Printmsg implementation using std periph. library<\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The configuration of peripherals by using the standard peripheral library is really an important thing. It will help you not only in UART peripheral configuration but also in the future. If you use any other peripheral like RTC or timers, you can quickly be able to understand since we have already covered the required steps. For most of the peripherals, the steps will be common.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">We have already completed all the <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"http:\/\/fastbitlab.com\/exercise-uart-parameter-inits\/\" target=\"_blank\" rel=\"noopener\">UART initializations<\/a><\/span>. In order to maintain some discipline, you have to create one more static void function, as shown in Figure 1. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let\u2019s call that function as prvSetupUart. This is the helper function to set-up the UART. Then remove all the codes inside the prvSetupHardware function (Figure 2) and paste it under the prvSetupUart function, as shown below code snippet.<\/span><\/p>\n<figure id=\"attachment_6280\" aria-describedby=\"caption-attachment-6280\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-6280\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-1-3.png\" alt=\"Figure 1. Creation of prvSetupUart function.\" width=\"744\" height=\"396\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3.png 1915w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-768x408.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-1024x544.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-800x425.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3-1200x637.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6280\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Creation of prvSetupUart function.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6281\" aria-describedby=\"caption-attachment-6281\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6281\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-2-3.png\" alt=\"Figure 2. prvSetupHardware function.\" width=\"744\" height=\"394\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3.png 1917w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-768x407.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-1024x542.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-600x318.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-500x265.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-800x424.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-2-3-1200x635.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6281\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. prvSetupHardware function.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\">&nbsp;<\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px;\"><span style=\"color: #993366;\">static void<\/span> prvSetupUart(<span style=\"color: #993366;\">void<\/span>)\r\n{\r\n   GPIO_InitTypeDef gpio_uart_pins;\r\n   USART_InitTypeDef uart2_init;\r\n\r\n   <span style=\"color: #008000;\">\/\/1. Enable the UART2 and GPIOA Peripheral clock<\/span>\r\n   RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2,ENABLE);\r\n   RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);\r\n\r\n  <span style=\"color: #008000;\"> \/\/PA2 is UART2_TX, PA3 is UART2_RX<\/span>\r\n\r\n<span style=\"color: #008000;\">   \/\/2. Alternate function configuration of MCU pins to behave as UART2 TX and RX<\/span>\r\n\r\n<span style=\"color: #008000;\">   \/\/zeroing each and every member element of the structure<\/span>\r\n  <span style=\"color: #993366;\"><strong> memset<\/strong><\/span>(&amp;gpio_uart_pins,0,<span style=\"color: #993366;\">sizeof<\/span>(gpio_uart_pins));\r\n\r\n   gpio_uart_pins.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3;\r\n   gpio_uart_pins.GPIO_Mode = GPIO_Mode_AF;\r\n   gpio_uart_pins.GPIO_PuPd = GPIO_PuPd_UP;\r\n   gpio_uart_pins.GPIO_OType= GPIO_OType_PP;\r\n   gpio_uart_pins.GPIO_Speed = GPIO_High_Speed;\r\n   GPIO_Init(GPIOA, &amp;gpio_uart_pins);\r\n\r\n\r\n <span style=\"color: #008000;\">  \/\/3. AF mode settings for the pins<\/span>\r\n   GPIO_PinAFConfig(GPIOA,GPIO_PinSource2,GPIO_AF_USART2); <span style=\"color: #008000;\">\/\/PA2<\/span>\r\n   GPIO_PinAFConfig(GPIOA,GPIO_PinSource3,GPIO_AF_USART2); <span style=\"color: #008000;\">\/\/PA3<\/span>\r\n\r\n  <span style=\"color: #008000;\"> \/\/4. UART parameter initializations<\/span>\r\n<span style=\"color: #008000;\">   \/\/zeroing each and every member element of the structure<\/span>\r\n   <span style=\"color: #800080;\"><strong>memset<\/strong><\/span>(&amp;uart2_init,0,sizeof(uart2_init));\r\n\r\n   uart2_init.USART_BaudRate = 115200;\r\n   uart2_init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;\r\n   uart2_init.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;\r\n   uart2_init.USART_Parity = USART_Parity_No;\r\n   uart2_init.USART_StopBits = USART_StopBits_1;\r\n   uart2_init.USART_WordLength = USART_WordLength_8b;\r\n   USART_Init(USART2,&amp;uart2_init);\r\n\r\n\r\n   <span style=\"color: #008000;\">\/\/5. Enable the UART2 peripheral<\/span>\r\n   USART_Cmd(USART2,ENABLE);\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">prvSetupUart function<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Then call prvSetupUart function from prvSetupHardware function. Because in the future, we will populate the prvSetupHardware function with various other peripheral initializations.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><strong><span style=\"color: #800080;\">static void<\/span> prvSetupHardware(<span style=\"color: #800080;\">void<\/span>)<\/strong>\r\n{\r\n&nbsp; &nbsp;<span style=\"color: #008000;\">\/\/setup UART2<\/span>\r\n&nbsp; &nbsp;prvSetupUart();\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">Calling prvSetupUart function from prvSetupHardware function<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let\u2019s give the prototype of the prvSetupUart function, as shown in Figure 3.<\/span><\/p>\n<figure id=\"attachment_6284\" aria-describedby=\"caption-attachment-6284\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6284\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-5-3.png\" alt=\"Figure 5. Prototype of prvSetupUart function.\" width=\"744\" height=\"395\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3.png 1919w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-768x407.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-1024x543.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-600x318.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-500x265.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-800x424.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-5-3-1200x636.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6284\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Prototype of prvSetupUart function.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now let\u2019s print some data over the UART because we have done all the initializations. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">To print over UART, let\u2019s create a small function called&nbsp; printmsg , and this function takes the pointer to the string. Let\u2019s mention it as a character pointer, as shown in Figure 4.<\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><strong><span style=\"color: #000000;\"><span style=\"color: #800080;\">void<\/span> printmsg(<span style=\"color: #800080;\">char<\/span> *msg);<\/span><\/strong><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now we created the printmsg function that returns nothing, but it takes the character pointer as an input parameter.<\/span><\/p>\n<figure id=\"attachment_6286\" aria-describedby=\"caption-attachment-6286\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6286\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-6-3.png\" alt=\"Figure 6. Prototype of printmsg function.\" width=\"744\" height=\"395\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3.png 1919w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-768x408.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-1024x544.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-800x425.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-6-3-1200x637.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6286\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Prototype of printmsg function.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let\u2019s implement the printmsg function. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here we receive the pointer to the string. Now let\u2019s again visit the usart.c (Figure 5), i.e., the driver file in order to explore what exactly is the API to transmit a byte over the UART peripheral.<\/span><\/p>\n<figure id=\"attachment_6287\" aria-describedby=\"caption-attachment-6287\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6287\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-7-3.png\" alt=\"Figure 7. stm32f4xx_usart.c\" width=\"744\" height=\"396\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3.png 1917w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-768x408.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-1024x544.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-800x425.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-7-3-1200x638.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6287\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. stm32f4xx_usart.c<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">If you explore usart.c, you can see send data and receive data APIs (Figure 6).<\/span><\/p>\n<figure id=\"attachment_6288\" aria-describedby=\"caption-attachment-6288\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6288\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-8-3.png\" alt=\"Figure 8. Send data and receive data APIs.\" width=\"744\" height=\"394\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3.png 1913w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-768x407.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-1024x542.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-600x318.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-500x265.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-800x424.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-8-3-1200x635.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6288\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. Send data and receive data APIs.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For this moment, we are not interested in receive data. So, let\u2019s not worry about that. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let\u2019s go for send data (Figure 7). For this, first, you have to give the base address of the UART peripheral that you are using, and in this case, that is UART2. You have to supply the data byte over the second parameter.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><strong><span style=\"color: #800080;\">void<\/span><\/strong> <strong>USART_SendData<\/strong>(USART_TypeDef* USARTx, uint16_t Data)\r\n{\r\n<span style=\"color: #008000;\">   \/* Check the parameters *\/<\/span>\r\n   assert_param(IS_USART_ALL_PERIPH(USARTx));\r\n   assert_param(IS_USART_DATA(Data)); \r\n\r\n<span style=\"color: #008000;\">   \/* Transmit Data *\/<\/span>\r\n   USARTx-&gt;DR = (Data &amp; (uint16_t)0x01FF);\r\n}<\/pre>\n<figure id=\"attachment_6289\" aria-describedby=\"caption-attachment-6289\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6289\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-9-3.png\" alt=\"UART Printmsg implementation using std periph. library\" width=\"744\" height=\"395\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3.png 1919w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-768x407.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-1024x543.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-600x318.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-500x265.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-800x424.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-9-3-1200x636.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6289\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. USART_SendData API.<\/span><\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In Figure 7, you can see that, as expected, the UARTs data register is populated with the data that is passed as a parameter of USART_SendData. This is how the transmission works. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the UART peripheral, whenever you load the DR, the transmission begins. If you want to know more about how the peripherals actually work, explore its functional block diagrams.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now let\u2019s go to the main.c and call send data API, as shown in Figure 8. Since this msg is the message, let\u2019s loop over this message in order to extract a single byte. For that, you can use for loop. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After that, let\u2019s send the data in the loop.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"box-shadow: #cecece 0px 0px 0px 0px inset; font-size: 12px;\"><strong><span style=\"color: #800080;\">void<\/span><\/strong> printmsg(<strong><span style=\"color: #800080;\">char<\/span><\/strong> *msg)\r\n{\r\n&nbsp; &nbsp;<span style=\"color: #800080;\">for<\/span>(<span style=\"color: #008000;\">uint32_t<\/span> i=0; i &lt; <span style=\"color: #800080;\">strlen<\/span>(msg); i++)\r\n&nbsp; &nbsp;{\r\n&nbsp; &nbsp; &nbsp; &nbsp;USART_SendData(USART2,msg[i]);\r\n&nbsp; &nbsp; }\r\n\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">Call for USART_SendData API<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the function call, the first argument is the UART peripheral base address, i.e., USART2, and the next one is data. Here the data is msg[i]. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now, in the send data API, the data that is passed over msg[i] is filled in the DR, and the transmission begins.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\"> Remember that you should not put another data into the DR or data register until that transmission ends. Otherwise, you will corrupt the data register of the UART. You have to be careful. So, wait until that transmission finishes.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\"> For that, the UART driver gives another API to check whether transmission has ended or not. Search the UART driver. You will get a GetFlagStatus function. You have to use this GetFlagStatus function.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\">FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, uint16_t USART_FLAG)\r\n{\r\n   FlagStatus bitstatus = RESET;\r\n  <span style=\"color: #008000;\"> \/* Check the parameters *\/<\/span>\r\n   assert_param(IS_USART_ALL_PERIPH(USARTx));\r\n   assert_param(IS_USART_FLAG(USART_FLAG));\r\n\r\n  <span style=\"color: #008000;\"> \/* The CTS flag is not available for UART4 and UART5 *\/<\/span>\r\n   <span style=\"color: #993366;\">if<\/span> (USART_FLAG == USART_FLAG_CTS)\r\n   {\r\n      assert_param(IS_USART_1236_PERIPH(USARTx));\r\n   } \r\n\r\n  <span style=\"color: #993366;\"> if<\/span> ((USARTx-&gt;SR &amp; USART_FLAG) != (uint16_t)RESET)\r\n   {\r\n       bitstatus = SET;\r\n   }\r\n   <span style=\"color: #993366;\">else<\/span>\r\n   {\r\n      bitstatus = RESET;\r\n   }\r\n   <span style=\"color: #993366;\">return<\/span> bitstatus;\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">GetFlagStatus function<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Which Flag status do you have to check? <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In Figure 8, you can see all the details of flags. For this example, you have to use the TXE flag, i.e., Transmit data register empty flag. Whenever you fill the data register, the data transmission begins, and when the data register becomes empty again, the USART_FLAG_TXE flag will be set in the status register. When the TXE flag is set, it\u2019s an indication that the data register is now empty. You can load another byte. Now let\u2019s wait until this flag is set in the status register of the UART peripheral. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the above code snippet, you can see that the return value of the function will be flag status, i.e., the new state of USART_FLAG (whether it is SET or RESET). So, this function returns SET or RESET. If TXE flag is SET, USART_GetFlagStatus function returns SET. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">From Figure 9, you can see that the SET means NOT of RESET, i.e., 1.<\/span><\/p>\n<figure id=\"attachment_6292\" aria-describedby=\"caption-attachment-6292\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6292\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-12-2.png\" alt=\"UART Printmsg implementation using std periph. library\" width=\"744\" height=\"395\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2.png 1917w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-768x407.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-1024x543.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-600x318.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-500x265.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-800x424.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-12-2-1200x637.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6292\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 8. Details of flags.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6293\" aria-describedby=\"caption-attachment-6293\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6293\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-13-2.png\" alt=\"UART Printmsg implementation using std periph. library\" width=\"744\" height=\"395\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2.png 1917w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-768x407.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-1024x543.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-600x318.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-500x265.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-800x424.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-13-2-1200x637.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6293\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 9. Value of SET and RESET.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Go back to the main.c, and before transmitting the data byte, confirm that the data register is empty. For that, let\u2019s use the USART_GetFlagStatus function, as shown in Figure 10. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here you have to wait until the return value is not equal to SET. Therefore, let\u2019s use a while loop.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"padding-left: 40px; font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><strong><span style=\"color: #993366;\">while<\/span><\/strong> ( USART_GetFlagStatus(USART2,USART_FLAG_TXE) != SET);<\/pre>\n<figure id=\"attachment_6294\" aria-describedby=\"caption-attachment-6294\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6294\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-14-2.png\" alt=\"UART Printmsg implementation using std periph. library\" width=\"744\" height=\"396\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2.png 1919w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-768x408.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-1024x544.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-800x425.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-14-2-1200x637.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6294\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 10. Checking the Status of TXE flag.<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Once the flag is set, the function will return SET, the control comes to the send data, and the data byte will be sent.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here we missed one configuration in the prvSetupUart. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After initializing the UART, you have to enable the UART peripheral. There is an enable bit in the control register of the UART. You have to enable that. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The fifth step is actually to enable the UART2 peripheral. For that, you have to use USART_Cmd API (Figure 11). <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now let\u2019s explore this API. This API enables or disables the specified USART peripheral. Now you have to give the base address of the USART peripheral that you are using, and you have to mention the new state, which may be enable or disable. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">If you mention enable, then that peripheral will be enabled, and it will be ready for the reception as well as transmission. If you disable, the peripherals TX and RX engine will be disabled. You have to use this API in your main.c; otherwise, this program will not work. So, please make the change shown in Figure 12.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"padding-left: 40px; font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #993366;\">void<\/span> USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState)\r\n{\r\n <span style=\"color: #008000;\">\/* Check the parameters *\/<\/span>\r\n   assert_param(IS_USART_ALL_PERIPH(USARTx));\r\n   assert_param(IS_FUNCTIONAL_STATE(NewState));<\/pre>\n<figure id=\"attachment_6295\" aria-describedby=\"caption-attachment-6295\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6295\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-15-2.png\" alt=\"UART Printmsg implementation using std periph. library\" width=\"744\" height=\"397\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2.png 1919w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-300x160.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-768x409.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-1024x546.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-600x320.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-500x267.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-200x107.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-800x426.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-15-2-1200x640.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6295\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 11. USART_Cmd API.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\"><span style=\"color: #008000;\">\/\/5. Enable the UART2 peripheral<\/span>\r\nUSART_Cmd(USART2,ENABLE);<\/pre>\n<figure id=\"attachment_6296\" aria-describedby=\"caption-attachment-6296\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6296\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/06\/Figure-16-2.png\" alt=\"UART Printmsg implementation using std periph. library\" width=\"744\" height=\"395\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2.png 1915w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-768x407.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-1024x543.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-600x318.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-500x265.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-800x424.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-16-2-1200x636.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6296\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 12. Call for USART_Cmd.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">In the following article, let&#8217;s learn<\/span> <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"http:\/\/fastbitlab.com\/exercise-testing-uart-prints\/\" target=\"_blank\" rel=\"noopener\">Testing UART prints<\/a><\/span>.<\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Exercise: UART Printmsg implementation using std periph. library &nbsp; &nbsp; The configuration of peripherals by using the standard peripheral library is really an important thing. It will help you not only in UART peripheral configuration but also in the future. If you use any other peripheral like RTC or timers, you can quickly be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6280,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[19],"class_list":["post-6275","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-freertos-lectures","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Exercise: UART Printmsg implementation using std periph. library<\/title>\n<meta name=\"description\" content=\"Enhance your STM32 project with UART printing capabilities. This guide explains how to set up UART communication and send messages using the\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Exercise: UART Printmsg implementation using std periph. library\" \/>\n<meta property=\"og:description\" content=\"Enhance your STM32 project with UART printing capabilities. This guide explains how to set up UART communication and send messages using the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-04T10:02:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-04T05:18:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1915\" \/>\n\t<meta property=\"og:image:height\" content=\"1017\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"FreeRTOS Lecture 37 &#8211; Exercise: UART Printmsg implementation using std periph. library\",\"datePublished\":\"2021-06-04T10:02:28+00:00\",\"dateModified\":\"2023-09-04T05:18:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/\"},\"wordCount\":1205,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/Figure-1-3.png\",\"keywords\":[\"FreeRTOS Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/\",\"name\":\"Exercise: UART Printmsg implementation using std periph. library\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/Figure-1-3.png\",\"datePublished\":\"2021-06-04T10:02:28+00:00\",\"dateModified\":\"2023-09-04T05:18:58+00:00\",\"description\":\"Enhance your STM32 project with UART printing capabilities. This guide explains how to set up UART communication and send messages using the\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/Figure-1-3.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/Figure-1-3.png\",\"width\":1915,\"height\":1017,\"caption\":\"Figure 1. Creation of prvSetupUart function.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FreeRTOS Lecture 37 &#8211; Exercise: UART Printmsg implementation using std periph. library\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Exercise: UART Printmsg implementation using std periph. library","description":"Enhance your STM32 project with UART printing capabilities. This guide explains how to set up UART communication and send messages using the","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:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/","og_locale":"en_US","og_type":"article","og_title":"Exercise: UART Printmsg implementation using std periph. library","og_description":"Enhance your STM32 project with UART printing capabilities. This guide explains how to set up UART communication and send messages using the","og_url":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2021-06-04T10:02:28+00:00","article_modified_time":"2023-09-04T05:18:58+00:00","og_image":[{"width":1915,"height":1017,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"FreeRTOS Lecture 37 &#8211; Exercise: UART Printmsg implementation using std periph. library","datePublished":"2021-06-04T10:02:28+00:00","dateModified":"2023-09-04T05:18:58+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/"},"wordCount":1205,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3.png","keywords":["FreeRTOS Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/","url":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/","name":"Exercise: UART Printmsg implementation using std periph. library","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3.png","datePublished":"2021-06-04T10:02:28+00:00","dateModified":"2023-09-04T05:18:58+00:00","description":"Enhance your STM32 project with UART printing capabilities. This guide explains how to set up UART communication and send messages using the","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/06\/Figure-1-3.png","width":1915,"height":1017,"caption":"Figure 1. Creation of prvSetupUart function."},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-37-exercise-uart-printmsg-implementation-using-std-periph-library\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FreeRTOS Lecture 37 &#8211; Exercise: UART Printmsg implementation using std periph. library"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=6275"}],"version-history":[{"count":4,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6275\/revisions"}],"predecessor-version":[{"id":15478,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6275\/revisions\/15478"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/6280"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=6275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=6275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=6275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}