Loading...
 
Skip to main content

System Workbench for STM32


Sending characters to a terminal emulator from the STM32469I-Discovery board?

Code below compiles and runs but nothing appears in an a PuTTY (or similar terminal emulator) window?

HAL_Init();

s_UARTHandle.Instance = USART3;
s_UARTHandle.Init.BaudRate = 115200;
s_UARTHandle.Init.WordLength = UART_WORDLENGTH_8B;
s_UARTHandle.Init.StopBits = UART_STOPBITS_1;
s_UARTHandle.Init.Parity = UART_PARITY_NONE;
s_UARTHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
s_UARTHandle.Init.Mode = UART_MODE_TX_RX;

if (HAL_UART_Init(&s_UARTHandle) != HAL_OK) {
//asm("bkpt 255");
}

sprintf((char *)buffer,"Test");

while(1) {
HAL_Delay(1000);
HAL_UART_Transmit(&s_UARTHandle, buffer, sizeof(buffer), HAL_MAX_DELAY);
}

Need more info. What have you done to try and debug this? What does your code in HAL_UART_MspInit() look like? Does it map the USART signals to the correct pins for the DISCO board (which pins are those)? On the PC, I presume you have the ST virtual COM port driver installed and you are connecting PuTTY to the correct COM port? How do you know that is the correct port?

What have you seen when you used the debugger to trace into the HAL_UART_Transmit() call? Does it appear to actually write the buffer contents to the USART TX register?

And probably not related to this, but something to look at anyway - you don't show the declaration for "buffer" so we don't know how big it is. You are storing 5 bytes in it ('T', 'e', 's', 't' plus trailing NULL), but then telling HAL_UART_Transmit() to send the entire buffer. At the very least in this case use strlen(buffer) instead of sizeof().