2022-10-25 09:31 AM
2022-10-28 01:26 AM
try:
char buffer[30];
.... &
HAL_UART_Transmit(UART_HandleType ....) // Send an amount of data in blocking mode.
2022-11-01 11:48 AM
For strcat() to work properly buffer[] needs to have a leading NUL character to indicate it is empty. Typically you'd avoid that with a strcpy() for the first string, and strcat()
2022-11-02 12:57 PM
thank you for the replies. I even initialized the char buffer[30] = {0} and then use strncat(). Also used HAL_UART_Transmit() but it just one character not transmitting. It transmitting most of it just misses one character from the string. Its transmitting "setfrequency 10" instead of "100". Dont know why?. Any suggestions?
2022-11-02 01:25 PM
> transmitting most of it just misses one character from the string.
Do you use UART (TTL) to USB adapter?
2022-11-02 04:19 PM
no I am not using UART(TTL) to USB adapter
2022-11-02 04:41 PM
Is your buffer array defined within a function or is it global? If it's in a function and you pass the address of the buffer to HAL_UART_Transmit_IT() then leave that function, the buffer array is no longer static. So any other resources can use that memory location and overwrite your buffer data.
Again, you've pasted snippets of your code but we don't know if the buffer array is inside or outside of a function that uses HAL_UART_Transmit_IT()? We don't know if you're in a loop? Paste your code with a little more information.
2022-11-02 04:46 PM
buffer array is defined within a function and it is not global. Does this buffer needs to be defined static and global.