Reading ALDL frames in VB

Posts: 53
Joined: Sun Aug 26, 2012 9:47 pm
Location: Brisbane

Reading ALDL frames in VB

Postby megajuz3003 » Tue Feb 27, 2018 7:28 pm

I'm playing around with reading data from my car with VB, primarily because I want more experience with programming fundamentals but I cant seem to get it right

I've tried various loops (while, do, try, for) with ReadByte after sending a request, and I get the frame back but its always out of order

essentially my code works by sending the frame then...

' n Chars of Bus into Buffer
Dim x As Integer = 0
Dim BufLen As Integer = ArrayBuffer.Length - 1

While x <= ArrayBuffer.Length - 1
ArrayBuffer(x) = SerialPort1.ReadByte
x = x + 1
End While

this reads 200 bytes from the data bus then passes it over to another loop to find the response...

I was wondering if anyone could point me in the right direction

Site Admin
User avatar
Posts: 5618
Joined: Sat Feb 28, 2009 8:34 pm

Re: Reading ALDL frames in VB

Postby antus » Thu Mar 01, 2018 4:34 pm

This is totally the wrong approch. You need to process the data like a stream. This will be very slow and accessing an array like that (eg incrementing x and the using it to write to an offset directly) is very not clean.

I'd recommend reading 2 bytes. Store the first as the device ID, the next as the length. Do the maths on the length then read the rest of the packet. This will work provided you dont get out of sync with the bus. Once you have this working look in to setting up a handler that can detect nonsense and reset and re-try to sync up. If you can handle it setting up a reader thread and processing data when you receive and event is more the correct approach.

Also, if you dont need to use VB, you might find something like C# is easier to use for this type of stuff, but ultimately thats your call. VB does not handle raw data particularly well though you can force it to work.
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

Posts: 8
Joined: Wed Aug 28, 2013 4:33 pm

Re: Reading ALDL frames in VB

Postby Majinsoftware » Thu Feb 14, 2019 5:42 pm

Did anything ever come of this.
Im writing plugins in C# for dyno software to support ALDL logging sensor data straight into dyno overlay. Any code any one can share will save me some time.

Site Admin
User avatar
Posts: 5618
Joined: Sat Feb 28, 2009 8:34 pm

Re: Reading ALDL frames in VB

Postby antus » Thu Feb 14, 2019 6:02 pm

Have a read of this viewtopic.php?f=10&t=219&p=2055#p2055
You'll need to get an adx for each car you want to support and save the offsets in the data returned for the pids your logging (though no actual pids in aldl) and the equasions.
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

Posts: 8
Joined: Wed Aug 28, 2013 4:33 pm

Re: Reading ALDL frames in VB

Postby Majinsoftware » Fri Feb 15, 2019 2:24 pm

Thanks, I had already had a read of that and got all the info I need. Was just hoping there was some .net code I could easily use to save time since iv got 4 datalogging protocols support so far out of a request list of 11 lol.

Posts: 311
Joined: Thu May 03, 2012 10:50 pm
Location: Castlemaine, Vic

Re: Reading ALDL frames in VB

Postby pman92 » Sat Feb 16, 2019 6:20 am

Not exactly what your after but have a look here
viewtopic.php?f=7&t=5165&p=88125#p88110
VR-VY Holden BCM Simulator: LINK
Ford Smartlock Bypass Module: LINK

Posts: 8
Joined: Wed Aug 28, 2013 4:33 pm

Re: Reading ALDL frames in VB

Postby Majinsoftware » Sat Feb 16, 2019 7:53 pm

Thanks, pman92. That has some good info there.
Iv got a sample module put together for my dyno datalogging software. Now I just need a car to test it on or some one thats kind enough to do a raw serial log of aldl communication that I can use to make a simulator out of.

Site Admin
User avatar
Posts: 5618
Joined: Sat Feb 28, 2009 8:34 pm

Re: Reading ALDL frames in VB

Postby antus » Sat Feb 16, 2019 10:56 pm

the xdl format is pretty basic, you can grab some random logs from this site, look in side and you should see device id, length, and then the packets, then time and counter or similar, then the next packet. you can grab some sample packets out of them then feed the data in to tunerpro as it requests packets from your simulator to test it.
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

Return to Tool Development

Who is online

Users browsing this forum: No registered users and 2 guests