pires / obd-java-api

OBD-II Java API
Apache License 2.0
595 stars 295 forks source link

OBD ELM327 Device returning NODATA for every request #58

Closed dnlgby closed 9 years ago

dnlgby commented 9 years ago

Before running any command, i run this init code:

    try {
        runCommand(sock, new ObdResetCommand());
        runCommand(sock, new EchoOffObdCommand());
        runCommand(sock, new EchoOffObdCommand());
        runCommand(sock, new LineFeedOffObdCommand());
        runCommand(sock, new TimeoutObdCommand(OBD_INIT_TIMEOUT_VAL));
        runCommand(sock, new SelectProtocolObdCommand(ObdProtocols.AUTO));
        runCommand(sock, new AmbientAirTemperatureObdCommand());

    } catch (Exception e)
    {
        throw new ObdConnectionFailure(e.getMessage());
    }

this code ends successfully, no exceptions.

after, i run some commands like: SpeedObdCommand EngineRPMObdCommand

And i always get NODATA as a result. I have 3 different obd devices, tried them all.

I have no idea what to try.

Thanks in advance.

anti43 commented 9 years ago

your car bus is too slow probably. increase the command delay.

2015-08-01 21:52 GMT+02:00 dnlgby notifications@github.com:

Before running ant command, i run this code: try { runCommand(sock, new ObdResetCommand()); runCommand(sock, new EchoOffObdCommand()); runCommand(sock, new EchoOffObdCommand()); runCommand(sock, new LineFeedOffObdCommand()); runCommand(sock, new TimeoutObdCommand(OBD_INIT_TIMEOUT_VAL)); runCommand(sock, new SelectProtocolObdCommand(ObdProtocols.AUTO)); runCommand(sock, new AmbientAirTemperatureObdCommand());

} catch (Exception e)
{
    throw new ObdConnectionFailure(e.getMessage());
}
  • OBD_INIT_TIMEOUT_VAL = 255

this code ends successfully, no exceptions.

after, i run some commands like: SpeedObdCommand EngineRPMObdCommand

And i always get NODATA as a result.

I have no idea what to try.

Thanks in advance.

— Reply to this email directly or view it on GitHub https://github.com/pires/obd-java-api/issues/58.

dnlgby commented 9 years ago

thanks anty, but my timeout val is 255, the max val (one second).

pires commented 9 years ago

@dnlgby the value is in milliseconds.

dnlgby commented 9 years ago

when i work with obd terminals i get results, even if i set the timeout to 255.

dnlgby commented 9 years ago

Its not 255*4, 1020 milliseconds?

anti43 commented 9 years ago

you misunderstood me probably. im not talking about the timeout val, its the delay inside the ObdCommand class

2015-08-03 11:03 GMT+02:00 dnlgby notifications@github.com:

when i work with obd terminals i get results, even if i set the timeout to 255.

— Reply to this email directly or view it on GitHub https://github.com/pires/obd-java-api/issues/58#issuecomment-127169981.

dnlgby commented 9 years ago

i see... But i get response, 'NODATA'. The time out you talking about is the time the request thread will sleep before getting the response. I'm getting response.

in ObdResponseException:isError (60): i can see that clean(response).matches(clean(message)); is True. means i get data and the data is NODATA.

dnlgby commented 9 years ago

changed ResponseTimeDelay to many values. same,

dnlgby commented 9 years ago

Another applications like torque working well...

pires commented 9 years ago

I have no idea why this happens.

Pho3niX90 commented 9 years ago

Try removing the speed up part, and test. https://github.com/pires/obd-java-api/blob/master/src/main/java/com/github/pires/obd/commands/ObdCommand.java#L44

Pho3niX90 commented 9 years ago

Also what vehicle is it? I have noticed specifically diesel bmws have some issues with obd2.

dnlgby commented 9 years ago

Tried. still the same :(

My vehicle is seat leon fr 2014.

FireWolf2007 commented 9 years ago

what is protocol used? maximum data on ISO_15765_4_CAN. Tested on VW Jetta 2013.

Pho3niX90 commented 9 years ago

@pires was I correct in saying it was the speed up command?

pires commented 9 years ago

@Pho3niX90 seems so.

dnlgby commented 9 years ago

actually not.

Log: 09-18 22:28:45.989 2177-2177/? I/Coffee-BluetoothConnectionTracker: Bluetooth connect broadcast for OBDII 09-18 22:28:45.993 4039-4039/? I/BTConnectionReceiver: onReceive(context, Intent { act=android.bluetooth.device.action.ACL_CONNECTED flg=0x4000010 cmp=com.google.android.googlequicksearchbox/com.google.android.search.core.service.BluetoothConnectionReceiver (has extras) }, [BluetoothDevice: address=00:0D:18:3A:67:89, alias=null, name=OBDII, majorDeviceClass=7936, deviceClass=7936] 09-18 22:28:45.994 4039-4039/? I/BluetoothClassifier: Bluetooth Device Name: OBDII 09-18 22:28:53.793 8000-8000/? D/daniel: com.github.pires.obd.exceptions.NoDataException: Error running 01 2F, response: NODATAnot successed 09-18 22:28:53.794 8000-8000/? W/System.err: com.example.dnlgby.car_data.exceptions.ObdCommandFailure: Error running 01 2F, response: NODATA 09-18 22:28:53.795 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.runCommand(ObdController.java:120) 09-18 22:28:53.795 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.CallObdFunction(ObdController.java:104) 09-18 22:28:53.795 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.OBDHandler.getOBDData(OBDHandler.java:40) 09-18 22:28:57.355 8000-8000/? D/daniel: com.github.pires.obd.exceptions.NoDataException: Error running 01 2F, response: NODATAnot successed 09-18 22:28:57.355 8000-8000/? W/System.err: com.example.dnlgby.car_data.exceptions.ObdCommandFailure: Error running 01 2F, response: NODATA 09-18 22:28:57.355 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.runCommand(ObdController.java:120) 09-18 22:28:57.355 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.CallObdFunction(ObdController.java:104) 09-18 22:28:57.355 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.OBDHandler.getOBDData(OBDHandler.java:40) 09-18 22:29:00.896 8000-8000/? D/daniel: com.github.pires.obd.exceptions.NoDataException: Error running 01 2F, response: NODATAnot successed 09-18 22:29:00.897 8000-8000/? W/System.err: com.example.dnlgby.car_data.exceptions.ObdCommandFailure: Error running 01 2F, response: NODATA 09-18 22:29:00.897 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.runCommand(ObdController.java:120) 09-18 22:29:00.897 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.CallObdFunction(ObdController.java:104) 09-18 22:29:00.897 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.OBDHandler.getOBDData(OBDHandler.java:40) 09-18 22:29:04.437 8000-8000/? D/daniel: com.github.pires.obd.exceptions.NoDataException: Error running 01 2F, response: NODATAnot successed 09-18 22:29:04.437 8000-8000/? W/System.err: com.example.dnlgby.car_data.exceptions.ObdCommandFailure: Error running 01 2F, response: NODATA 09-18 22:29:04.437 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.runCommand(ObdController.java:120) 09-18 22:29:04.437 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.CallObdFunction(ObdController.java:104) 09-18 22:29:04.437 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.OBDHandler.getOBDData(OBDHandler.java:40) 09-18 22:29:07.943 8000-8000/? D/daniel: com.github.pires.obd.exceptions.NoDataException: Error running 01 2F, response: NODATAnot successed 09-18 22:29:07.943 8000-8000/? W/System.err: com.example.dnlgby.car_data.exceptions.ObdCommandFailure: Error running 01 2F, response: NODATA 09-18 22:29:07.943 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.runCommand(ObdController.java:120) 09-18 22:29:07.943 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.ObdController.CallObdFunction(ObdController.java:104) 09-18 22:29:07.943 8000-8000/? W/System.err: at com.example.dnlgby.car_data.obd.OBDHandler.getOBDData(OBDHandler.java:40) 09-18 22:29:14.180 2177-2177/? I/Coffee-BluetoothConnectionTracker: Bluetooth disconnection broadcast for OBDII 09-18 22:29:15.293 4039-4039/? I/BTConnectionReceiver: onReceive(context, Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED flg=0x4000010 cmp=com.google.android.googlequicksearchbox/com.google.android.search.core.service.BluetoothConnectionReceiver (has extras) }, [BluetoothDevice: address=00:0D:18:3A:67:89, alias=null, name=OBDII, majorDeviceClass=7936, deviceClass=7936] 09-18 22:29:15.294 4039-4039/? I/BluetoothClassifier: Bluetooth Device Name: OBDII

Pho3niX90 commented 9 years ago

@dnlgby seems it's only fuel level not working for you? It isn't supported by all cars. Not even toeque has it implemented. But try via a eln327 obd2 terminal

dnlgby commented 9 years ago

seems like you are right. working well now.

Thank you!