I concanate two strings using strcat. Then I transmit that strings through uart2 but when I check in the putty terminal the string is showing half of it. It is not showing full string on the putty terminal. Any idea about this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-25 09:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-28 01:26 AM
try:
char buffer[30];
.... &
HAL_UART_Transmit(UART_HandleType ....) // Send an amount of data in blocking mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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()
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 04:19 PM
no I am not using UART(TTL) to USB adapter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- « Previous
-
- 1
- 2
- Next »