cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up terminal (TeraTerm etc) interface with STM32L476VG-DISCOVERY board

Posted on March 04, 2018 at 00:58

Hi,

I am developing a code in Visual Studio/visualgdb for STM32L476VG Discovery Board. How do I set up UART on this board so that I would be able to print my output on a terminal program (teraTerm, PuTTY etc)? Is there any standard code library available for this specific problem? I am using ST-Link debugger and STM32CubeMX for skeleton code generation.

Thank you!

1 REPLY 1
Posted on March 04, 2018 at 16:12

Initialize the port/pins supporting the VCP on your board (see User Manual)

Add code hosting that USART

#ifdef __GNUC__

/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf

set to 'Yes') calls __io_putchar() */

#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)

#else

#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)

#endif /* __GNUC__ */

...

/**

* @brief Retargets the C library printf function to the USART.

* @param None

* @retval None

*/

PUTCHAR_PROTOTYPE

{

/* Place your implementation of fputc here */

/* e.g. write a character to the USART1 and Loop until the end of transmission */

HAL_UART_Transmit(&UartHandle, (uint8_t *)&ch, 1, 0xFFFF);

return ch;

}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..