# STM32 LPUART1 **Board using:STM32L496xx** ## spec reaing LPUART communication is defined in spec using PG7 and PG8. ![](https://hackmd.io/_uploads/SyPpfwQ42.png) ![](https://i.imgur.com/ELhNPp3.png) ## MX Cube settings ![](https://i.imgur.com/w3ktdSA.png) ![](https://i.imgur.com/KlZGEmR.png) ![](https://i.imgur.com/0KNQTh6.png) ## Code in main.c ``` /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "stdio.h" #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) /* USER CODE END Includes */ /* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ PUTCHAR_PROTOTYPE { HAL_UART_Transmit(&hlpuart1, (uint8_t *)&ch, 1, 0xFFFF); return ch; } /* USER CODE END 0 */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ printf("Hello\n\r"); HAL_Delay(500); } /* USER CODE END 3 */ ``` ## Press start debug session and RST Set Microlib, Need Microlib to support printf ![](https://hackmd.io/_uploads/BkOrALQ42.png) ![](https://i.imgur.com/Q227MNC.png) ## Finished ![](https://i.imgur.com/U0oTQyS.png) ## Reference ![](https://i.imgur.com/jXS6MOY.png) https://www.youtube.com/watch?v=jZkLCzlPylY&list=PLYgGtiVoYLPdGLtOJ2Sci0ewZCfBLdabN&index=4