Why USB Virtual Com Device miss Empty Byte?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-19 9:42 AM
I have created project USB Virtual Com Device on STM 32F407. I set size of parcel = 32 byte. When i send parcel and befor parcel ends byte will be "0" STM 32 don't read bytes after "0". If no "0" byte always is OK. What doe's it mean? How get full parcel with "0" bytes inside parcel?
Solved! Go to Solution.
- Labels:
-
DEBUG
-
STM32F4 Series
-
USB
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-20 7:43 AM
On your screenshot, line 285: is this a strncpy?
Do not use string functions on raw (binary) data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-20 12:51 AM
"0" is "end of string" sign in C.
so if data is a string of characters, NULL is signal for end of string ( and transmission).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-20 6:02 AM
That is, it turns out that I cannot send the DEC array = {1, 10, 0, 0, 0, 75, 255, 117 , 256, 128}.
Will I have to reformat the array to a char? So this will increase the size of my package. How then to define "0"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-20 6:29 AM
That is, it turns out that I cannot send the DEC array = {1, 10, 0, 0, 0, 75, 255, 117 , 256, 128}.
Will I have to reformat the array to a char? So this will increase the size of my package. How then to define "0"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-20 7:36 AM
why not send data as ascii ? so 0x0 -> 0x30 ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-20 7:43 AM
On your screenshot, line 285: is this a strncpy?
Do not use string functions on raw (binary) data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-21 2:01 AM
memcpy solved the problem, thanks a lot
