High Latency for real time application with hardware serial
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
High Latency for real time application with hardware serial
I have a project where I receive data from the serial port and then send a response. I have noticed that my system (NanoPi NEO core 2) has a latency of 1 millisecond. I want to reduce it to at least 0.3 milliseconds when receiving interrupts.
I would like to know if I am setting correctly the serial port options or if I am missing something. I have a digital scope (see image), when the interrupt happens I enable a GPIO to measure the time it takes for the interrupt to be called.
I'm not with your code, or your hardware. It strikes me that there are several points for latency. GPIO is not particularly fast, serial is dead slow, delays are possible in your external hardware. I would expect it to be faster also. Set up some sort of chain like this, deleting what doesn't apply and inserting missing items
Software control signals to GPIO
Software data signal to gpio
Any further delay in pc
Baud rate
Signal received in external hardware
Signal returned in external hardware
Baud rate of return signal
PC delays in processing result
You can find exactly where your delay appears. We couldn't guess.
Your controls from the pc end are increasing the baud rate and decreasing handshake time. Beware that your pc might be doing RS-232 but your hardware could be I^2C; I've seen guys caught by that before. RS-232 requires -5V/+5V; I^2C is 0-5V. Trickiest is where the thing works, somebody swaps a chip and nothing works.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.