-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The length of each receiving of UART #5
Comments
This seems similar to #4. I'll copy my response there. In general, you should expect UART data to come in intermittently. Although it may stream continually, the interrupts may be fired at any point. You should buffer the data and determine the stop point on your own, then process it. Generally, embedded engineers will do several different steps to properly segment the data: Use a fixed size, ie. assume every packet is 3 bytes |
Thanks for your answer! |
Maybe you can use an Is there any sort of expectation you can make about the data? When I've used Modbus, there have been certain types of expected payloads that made it easier to implement. |
Thanks again,My mind is still stuck on C. I'll try to use arraylist. |
If I'm talking from Android Things to a Modbus peripheral, or vice-versa, there should be some established protocol of the types of messages being sent. You should be able to use that protocol in order to find when to do the cut-off. |
I think I see what you mean,like GPS protocol, |
If there's no way to judge with start/end characters, you may be able to log the timestamp of each UART event and split it that way. |
OK, I will try to do this and thanks for your kind help |
I'm going to use android things to implement the modbus protocol,But I've found that when android things receives a piece of data, it's automatically divided into many segments. Is there any way to get it to be done like a single chip?


The text was updated successfully, but these errors were encountered: