2023-02-15 01:04 AM
Working on a prototype and am using HAL_UART_Transmit to output to UART2. Upon output over UART2 the string seems to be truncated. Code below:
```
char stuff[] = "HELLO YOU FINE FELLOW";
HAL_UART_Transmit(&huart2,stuff,sizeof(stuff),1);
```
Output is HELLO YOU FINE FEL.
Any advice would be helpful.
2023-02-15 01:43 AM
Ask a noob question and voila I stumble across the answer. Strangely enough the answer was the timeout in HAL_UART_Transmit ?
2023-02-15 08:46 AM
Not causing THAT problem, but also a "noob" mistake with the "size" parameter. Question: what is the difference between sizeof(stuff) and strlen(stuff)? And why is there a difference? Is it sending what you expect?
2023-02-15 08:52 AM
Use strlen() for strings otherwise you'll get the NUL terminator transmitted too. The timeout needs to provide for sufficient time to transmit all the bytes at the baud rate you're using.
at 9600 baud around millisecond a character.
2023-02-15 10:34 PM
Actually I wonder why there is a notion of a timeout for a usart TX.... to generate posts ?