Timeline for send mixed data over serial
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 29, 2024 at 12:01 | comment | added | jantje | I have no Arduino code to demonstrate it. | |
| Jul 28, 2024 at 8:01 | comment | added | Geralt von Riva | Yeah I was wondering about that. As per your example, I'm transferring the data in byte-sized packages. If I were to use the single character "x" as a sync byte, it would be possible that an unsigned integer I'm sending coincidentally has the same binary representation as "x", thus falsely being recognized as the sync byte and shortly bugging the communication. So I would need to use multiple sync bytes as per your suggestion, perhaps 3 or 5. The readBytesUntil() function only allows for a single character however. Do you have experience on how to best handle that? | |
| Jul 27, 2024 at 19:09 | comment | added | jantje | In a binary stream 1 character will not do the job. | |
| Jul 26, 2024 at 17:39 | comment | added | Geralt von Riva | I'd probably best use the readBytesUntil() function instead of reading a fixed number of bytes? | |
| Jul 25, 2024 at 16:45 | comment | added | jantje | @GeraltvonRiva Once you get out of sync between the 2 CPU's you will never recover. To add "stability" send a number of sync bytes in between the packages. | |
| Jul 23, 2024 at 14:47 | comment | added | Geralt von Riva | Thanks for this approach. I've been able to successfully implement it for communication between two Teensy 4.1 boards. However, it seems that as soon as the read or the write buffer is even used (not overflowed), the connection only transmits garbage. Consistently, though, like there has been a shift in bits or something like that. It doesn't give out changing random numbers but always the same wrong one. Do you perhaps have an explanation for that, even with this rough problem description? Thanks in advance! | |
| Jul 11, 2016 at 12:13 | comment | added | user3060854 | @jante I didn't expect so many answers, thus I need some time to work them out. Thank you. | |
| Jul 9, 2016 at 16:06 | history | answered | jantje | CC BY-SA 3.0 |