So Iv seen alot of threads and comments about finding good OBD2 software to use with an elm.. and well... So far the options are very limited! Alot of the current programs either a) cost money for a useless software or b)are free/cheap but dont work correctly.
Then finding an application that will present the manufacture specific codes is even harder to find, let alone finding one for Holden!
So the aim here is to develop a basic application to read holden commodores fault codes, including history and present codes. As well as identifying the cable and current details.
Some reading material for the OBD2 protocol:
http://www.fastfieros.com/tech/vpw_comm ... otocol.htm
And the ELM327 datasheet:
So the first plan of action is making something successfully send a message to the elm327 device to check that the cable is present, and that communication is working.
Next will be to set the required conditions such as turning on headers,turn off echo,remove null bytes ect.
And lucky last, applying the above to successfully send a request eg 01 04 which is a mode 1 request for PID section 4.
For fault codes, we will be investigating mode 3 and 7. I *think* 3 is current codes and 7 are history.. (not 100% sure).
First up, connecting to the elm device, and checking that it is present.
The elm connection requirements are: baud rate to 38400, set to 8 bits, no parity bits,1 stop bit and set it to the correct line end mode (single carriage return character).
So thats easy enough to setup! Now we want to actually check that we have connected to an elm device, So now we will want to send "ATZ" which is the command to "reset" the ELM device, and the ELM devce will send over serial "ELM327 v1.5" (whatever version), which will end in a carriage return that software can pickup as the end or message.
The ELM will also spit out ">" after all commands, this signifies that device is idle and ready for a request.. so will need to add a function in to check for this after receiving a message to check that is the end of the potential message/s.
Currently, I am using this code to request info from the elm device to check if device is present:
- Code: Select all
Public Function DetectElmDeviceGetResponse(SentFrame As String)
Dim ReceivedFrame As String = ""
Dim Counts2Exit As Integer = 0
Do 'do until exited
'if there is something there.. read it!
ReceivedFrame = SerialPort1.ReadLine 'Read Message!
If ReceivedFrame <> SentFrame Then 'check if recieved frame matches sent.. ignore if so
If ReceivedFrame.Contains("SEARCHING...") Then 'ignore.. move onto next
ElseIf ReceivedFrame.Contains("NO DATA") Then 'ELM says no response.. fail! Shouldnt happen since gtting Elm info!
Return ReceivedFrame 'hopefully out response
Catch ex As TimeoutException 'if nothings available, timout after 1 second.
Counts2Exit += 1
If Counts2Exit = 4 Then 'fail after timeout 4times
SetRichTextBox_ThreadSafe("Timed Out!", RichTextBoxReceive)
SetRichTextBox_ThreadSafe("Timed out.. Searching again.." & Counts2Exit, RichTextBoxReceive)
The above code doesnt have any implementation to check for the elm device at idle (">"), and currently isnt picking up the elm device. I am hopefully getting a cable in the next couple days so I can properly debug the application to check why its missing the frame, although using a "elm327 emulator" works with the above code.