Initialization of obd adapter

╄→гoц情女王★ 提交于 2019-12-12 09:03:29

问题


I am developing a android application which reads Obd data from vehicle's Obd adapter via bluetooth... I am facing issue while initializing the adapter. I have sent following Obd commands in sequence to initialize the obd :

  1. atz (received OK)
  2. atsp0 (Received OK)
  3. ate0 (Received OK)
  4. 0100 (This is the part where issue occurs)...

Some times for this command i receive BUSINIT:ERROR.. And after that for every vehicle command (except AT commands) same error is repeated..

I want to know the Exact initialization sequence ?


回答1:


It seems your obd initialization and obd protocol selection failed. You should follow these steps:

AT D
AT Z
AT E0
AT L0
AT S0
AT H0
AT SP 0

When protocol selection command response without any error like listed below, your connection is OK and you can request new commands like '0100' command.


Errors:

  • UNABLE TO CONNECT
  • BUS INIT... ERROR
  • ?
  • NO DATA
  • STOPPED
  • ERROR

Command Explanation:

AT D -> Set all to defaults

AT Z -> Reset Obd

AT E0 -> Echo off

AT L0 -> Line feed off

AT S0 -> Spaces off

AT H0 -> Headers off

AT SP 0 -> Set Protocol to 0 "Auto", search all protocols and connect it with proper protocol for that obd

For AT SP command, if you know your vehicle's obd interface protocol, you can choose that specific protocol other than make Auto and search all possible protocols. You can use different inputs:


Protocol Parameters: Hex[0,1,2, ... ,B,C]

Auto select protocol and save. AUTO -> 0

41.6 kbaud SAE_J1850_PWM -> 1

10.4 kbaud SAE_J1850_VPW -> 2

5 baud init ISO_9141_2 -> 3

5 baud init ISO_14230_4_KWP -> 4

Fast init ISO_14230_4_KWP_FAST -> 5

11 bit ID, 500 kbaud ISO_15765_4_CAN -> 6

29 bit ID, 500 kbaud ISO_15765_4_CAN_B -> 7

11 bit ID, 250 kbaud ISO_15765_4_CAN_C -> 8

29 bit ID, 250 kbaud ISO_15765_4_CAN_D -> 9

29 bit ID, 250 kbaud (user adjustable) SAE_J1939_CAN -> A

11 bit ID (user adjustable), 125 kbaud (user adjustable) USER1_CAN -> B

11 bit ID (user adjustable), 50 kbaud (user adjustable) USER2_CAN -> C




回答2:


"AT E0"

"AT L0"

"AT ST 00"

"AT SP 00"

Works for me. And one more thing... I send all these commands one after another with the delay of 500ms! Without a delay the initialization fails almost every time, don't forget, this is bluetooth and it requires more time to send and receive responds...




回答3:


Your initialisation sequence should work if the hardware is fully OBD-II compatible and the car is OBD-II compliant. If you still get errors on the 0100 command, check the ignition is on and the hardware is fully operational.




回答4:


0100 is the first command which will reach the actual car. The AT commands are tor the (ELM327)-chip. So something is wrong with the communication between OBD connector and the car. Connection between your app and the connector is fine.

Obdkey is most likely to be right about the OBD-II compatibility. Please try to use an existing app to prove that, if it doesn't work, something is wrong with your car, or connector.

Btw: It's helpfull to state which obd-II adapter you have, and maybe your car.




回答5:


Just wanted to put my two cents in. I've been recently developing an application in C++ and LabVIEW to communicate to a ELM-327 - based bluetooth module to retrieve information from my car's ECU. Sometimes the initialization sequence fails, sometimes it works. What I've found is that the 'keywords' bytes of the ECU protocol initialization are sometimes not being detected correctly. I think my bluetooth module is the problem, because it turns out is a chinese clon of a legit ELM-327. How do I know that? If you issue the command ATI , it would reply "ELM-327 ver. 1.5", and according to the manufacturer, they NEVER released a 1.5 version =D

What has worked for me is something like this:

  1. Open communication, send ATZ
  2. ATSP0
  3. ATSS (This enables the recommended protocol search order)
  4. 010D
  5. If 4. fails, then close communication, wait 3 or more seconds and GO TO 1
  6. More OBD-II or AT-Commands.

The BUSINIT:...ERROR response means that the ELM-327 was unable to finsh the start-up sequence of the ECU protocol. Also, before sending an OBD-II command, like 010C, you can initialize the communications with the ATSI command, if your can happens to use the ISO-9141-2 or ISO-14230-4 KWP protocols.

You can find out what protocol your car uses if you send the command ATDP to the ELM-327 after succesfull automatic detection.

Hope this helps.



来源:https://stackoverflow.com/questions/13764442/initialization-of-obd-adapter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!