Arduino Library

Holden/Delco Tuning. ALDL, OBD 1.5. Circa 1989 to 2004.
pman92
Posts: 464
Joined: Thu May 03, 2012 10:50 pm
cars: HZ One Tonner
VE Ute
Location: Castlemaine, Vic

Re: Arduino Library

Post by pman92 »

VL400 wrote:Nice project, that sunglass holder face plate is neat as :thumbup:

The attached might help get you started reading ALDL data :) The displays you are using, depending on the library may tie up the arduino for a bit of time so logging speeds get pretty slow.
Hi VL400,
Ive had a good look at the code you have posted here and have a pretty good idea of whats going on. However ive got a few questions:

-If this ALDL.read() function is called when the UART has half received an ALDL message, say it has received 5 bytes of a aldl frame that is 10 bytes long, will calling this function lose that frame even if it was going to be perfectly valid?

-At the top of the function it checks for a timeout (ALDL_TIMEOUT). How many milliseconds should this be, is it a timeout per byte (say just a couple of ms), or what is the idea here?

Thanks
VR-VY Holden BCM Simulator: View Post
MrModule.com.au
User avatar
VL400
Posts: 4991
Joined: Sun Mar 01, 2009 2:54 pm
cars: VL Calais and Toyota Landcruiser. Plus some toys :)
Location: Perth, WA
Contact:

Re: Arduino Library

Post by VL400 »

Got your PM and have attached an updated version of the text file posted on page 1, should answer most of both your questions. But to add some extra...
1) Call the function when bytes are available and it will handle the frame. Returns true when it has something valid and then you can do something with the frame.
2) The timeout is really for VT and later, there is a 128ms gap after the heartbeat frame. If there is 100ms (the timeout value) of no bus activity the function resets and assumes the next byte will be a device ID. It just helps get and keep things in sync as it is possible to continually attempt to try reading device IDs mid way through a frame and then get constant checksum errors. This way it pretty much means you only get a max of about 200ms of bad frames when getting sync on the bus and then the code sorts itself.
Attachments
ALDL_Example.txt
(2.76 KiB) Downloaded 324 times
pman92
Posts: 464
Joined: Thu May 03, 2012 10:50 pm
cars: HZ One Tonner
VE Ute
Location: Castlemaine, Vic

Re: Arduino Library

Post by pman92 »

Thanks vl400, that all makes sense now. Just check if serial data is available, if so call the function, if the function returns true process the frame in the buffer.
I was a bit confused with the timeout byte time being reset outside of the while(), but if the function only gets called inside if(serial.available()) that makes sense.

Another question, how big should the buffer size be? What is the absolute longest ALDL frame you will see on a VR/VS or later VT onwards?

And another question, if I was to make an ALDL send function that just takes a device ID, mode and data etc. Then puts its in a byte array with the correct data length byte and checksum, and sends it with serial.send().
Should I be waiting for bus silence before calling serial.send()?
Should I first disable chatter once I detect silence before sending other data, or is that only required on VT>?
Do all devices use the same mode to disable/enable chatter? (Eg do I just send a disable chatter to device BCM, then send the same message to PCM with just the different device ID for pcm?)
Do devices send a response saying they have disabled chatter?

I know these are probably all basic questions but I haven't found definitive answers searching.
Ive found a few spare PCMs and im excited to have a play around with this, I'll probably be able to find answers to some of my questions myself
VR-VY Holden BCM Simulator: View Post
MrModule.com.au
Post Reply