[Rxtx] Latency Woes
Bob Jacobsen
bob_jacobsen at lbl.gov
Tue Mar 8 00:02:28 MST 2011
If you're transferring three bytes total at 1953 baud, it's going to take 3*(8+2)*1000/1953 = 15.4 msec no matter what. Having to wait 20msec to get the data back instead of 15.4 msec doesn't seem to be as big a problem as you're making it sound.
Bob
On Mar 7, 2011, at 8:04 PM, Curtis Hacker wrote:
> I guess I'm gunna need some serious help with this then, because of the scenario I'm stuck with.
>
> To communicate there is only 1 data line, rx/tx tied together with a diode protecting the tx. No RTS/CTS handshaking nothing..
>
> So the ecu can't process the next byte of info, without you pulling the 2 bytes back. I wish this was standard, but even the baud rate isn't (1953). OBD1.5 crap. I am really stuck in a hard spot with this..
>
> in.read(data, 0, 2);
> ^ would the above wait till the timeout to read 2 bytes ? or read 1 byte wait for the 2nd ? or just read the 1 ??
>
> On 03/07/11 18:50, jfh at greenhousepc.com wrote:
>> Curtis,
>>
>> No, I assume he means a real queue, not just "don't read all the bytes at once." However, if you know you can process some number of requests in some amount of time, allowing data to pile up (receiver FIFO space permitting) can be a valid strategy. Inserting gobs of Thread.yield() and notify() can help pep things up as well.
>> --
>> Julie Haugh
>> Senior Design Engineer
>> greenHouse Computers, LLC // jfh at greenhousepc.com // greenHousePC on Skype
>>
>>
>> -------- Original Message --------
>> Subject: Re: [Rxtx] Latency Woes
>> From: Curtis Hacker <hakcenter at gmail.com>
>> Date: Mon, March 07, 2011 8:24 pm
>> To: rxtx at qbang.org
>>
>> Sample code ?
>>
>> I don't necessarily want to read the byte I just wrote, but wait till
>> the que depth is 2.
>>
>> Setup a thread without a sleep timer:
>> if (in.available() > 1) {
>> do_stuff();
>> }
>>
>> ??
>>
>> On 03/07/11 18:08, Adrian Crum wrote:
>> > Drop the requests into a queue, and then have a separate thread
>> > service the queue.
>> >
>> > -Adrian
>> >
>> > On 3/7/2011 5:55 PM, Curtis Hacker wrote:
>> >> I have finally deduced my slow data logging to a latency issue.
>> >>
>> >> I write software for dsms, and the protocol is request / receive, you
>> >> cannot do more than 1 sensor at a time. So when you log multiple
>> >> sensors, +20ms per item, sampling rate drops like a rock.
>> >>
>> >> I was wondering if there is any ideas besides going completely native
>> >> with my application to reduce latency. With or without events I don't
>> >> care at this point I need to kill as much of the latency as possible.
>> >> Realistically I need no more than 1ms.
>> >> _______________________________________________
>> >> Rxtx mailing list
>> >> Rxtx at qbang.org
>> >> http://mailman.qbang.org/mailman/listinfo/rxtx
>> > _______________________________________________
>> > Rxtx mailing list
>> > Rxtx at qbang.org
>> > http://mailman.qbang.org/mailman/listinfo/rxtx
>> >
>> _______________________________________________
>> Rxtx mailing list
>> Rxtx at qbang.org
>> http://mailman.qbang.org/mailman/listinfo/rxtx
>>
>>
>> _______________________________________________
>> Rxtx mailing list
>>
>> Rxtx at qbang.org
>> http://mailman.qbang.org/mailman/listinfo/rxtx
> _______________________________________________
> Rxtx mailing list
> Rxtx at qbang.org
> http://mailman.qbang.org/mailman/listinfo/rxtx
--
Bob Jacobsen, LBNL
Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG
More information about the Rxtx
mailing list