Comment on Missing data when communicating over UART
bvoigtlaender@feddit.org 1 week agoThank you so much. That might actually be it. I didn’t had the time to fully implement that yesterday but will be today. I did however put in a sleep() after waiting for the buffer and reading it to validate your thesis, which results in complete data!! ^^
Arduino even has an function for that readBytesUntil. However in my short testings yesterday in seemed to always stop on new lines, even if I set the char for it to stop on to something really silly. Reading it and implementing that stop on my own worked better. I wanna do it the “official” way though, it would then even respect an timeout set by setTimeout
I will probably end up having CTS and RTS anyway cause I couldn’t make sure that the module starts to talk all of the sudden.
I hate that the answer to my problems are always the most stupid ones. I kinda wish it would have been signal integrity, but I would probably regret that real fast too. :)
bitfucker@programming.dev 1 week ago
Yeah, CTS and RTS is useful for the module since you may overflow the module buffer (instead of the module overflowing your UART buffer). With proper HW flow control, hopefully your device UART respects the signal and pauses the tx until it is clear again without you having to code the pause yourselves. It can happen when the GSM bandwidth is lower than the UART bandwidth.
The module suddenly talking should also be handled by your device UART gracefully. When your rx buffer is full for whatever reason (not reading it for a long time?), the module won’t be sending anymore data until you read your rx buffer. Theoretically, no data should be lost that way.