Hello. I am currently working with the STM32L031 Nucleo board:
The board has integrated ST-LINK so it is quite easy and convenient to flash the device and debug the code. I also use the following code the be able to use printf statements to the console:
/* 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)
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF);
I am planning to design my own board based on STM32L031. My custom board is not going to have integrated ST-Link. Instead, I will be using J-Link Plus Compact and a 10 pin Tag Connect to flash and debug the device.
Since this is my first time designing PCB based on STM32L031, I would like to clarify what is the correct way to route the STM32L031 to Tag connect(JLINK).
I have found the following pinout for the 10-pin Tag Connect:
From what I understand, this should allow me to Flash and Debug. How can I also connect RX/TX for UART printfs?
Additionally, I would like to understand what are the TDI and TDO pins used for? The difference between 6 pin Tag Connect and 10 pin Tag Connect seems to be TDI and TDO pins
Instead of the 10-pin connector, consider the extended 14-pin connector and ST-LINKv3.
The RX/TX for UART connect to pins 13,14 on the connector for flat cable or to the golden strips connector on the ST-LINK itself. TDI, TDO pins are for JTAG, you don't need these. Use the SWD mode.
Thanks for suggestion. Are there any other methods available? The board that I am designing is a very small device and using 14 pin connector might be an issue. I am already stretching it by using 10 pin connector...
My other idea:
use 6 pin Tag Connect for flashing and debugging and route USART2 RX/TX pins to some external header where I can connect USB->UART converter such as:
That would allow me to use printf to console.
Is my idea correct?