2

I am not able to received complete responses from my BLE device which I am supposed to receive for the commands written to characteristics using flutter_blue. What I am receiving in response is the command itself which I sent for write. The responses received are being decoded properly.

The commands which I'm trying to write are OBDII protocols which are

AT Z
AT H0
AT H0
AT L0
AT S0
01 0C

Surprisingly the command "AT Z" gives response "ELM 327v1.5" which is correct. This is the only command from which I am receiving the correct response. All other commands are returning the command itself which is partially correct because most of the times the actual responses are received along with the command name.

The response reading and decoding is implemented in the following way

await read_CX.setNotifyValue(true);

read_CX.value.listen((response) {
  print(utf8.decode(response));
}

Has anyone faced similar issue of receiving incomplete data? Can anyone please help me out?

Thanks!!

vibu
  • 77
  • 1
  • 8
  • Yes. Upon using it, its having the same response. – vibu Dec 24 '20 at 10:29
  • Could you try to use the nRF Connect app and manually execute the requests? Then you can see if the data is correct in the first place at the protocol level. – Emil Dec 24 '20 at 12:06
  • Upon sending "AT Z" I am getting the command back in response. I've tried this using multiple devices but the response is same. I've used nRF Connect app and BLE Laboratory app. The responses are same. I am getting the desired responses when sending the commands via iOS native code i.e Swift. – vibu Dec 24 '20 at 14:10
  • hey @vibu have you implemented OBD in flutter ,Working ? I am also trying to implement but facing some issue can you please help me out – Ravish Sharma Mar 05 '22 at 15:30
  • hi @RavishSharma. what issue are you facing? – vibu Mar 10 '22 at 04:45
  • @vibu thanks of the reply .I am not able to write OBD commands and don't know how to parse the data .Can you please provide any example or source code link.It would be really helpful – Ravish Sharma Mar 10 '22 at 10:01
  • For writing the PIDs you can encode the data using `utf8.encode(PID)` and for reading the responses you can use `String.fromCharCodes(RESPONSE)`. What are you using for connectivity? – vibu Mar 11 '22 at 04:47
  • @vibu I am using flutter_blue for connectivity .Have you done with OBD or still working ?Which plugin you have used for connectivity – Ravish Sharma Mar 14 '22 at 15:47
  • @RavishSharma we can continue discussion at discord. my username is anhc#8972 – vibu Mar 15 '22 at 05:56
  • @vibu I have sent you friend request on discord .can you please check – Ravish Sharma Mar 15 '22 at 17:09

1 Answers1

2

First, add ATE0\r to your init sequence, this will stop the adapter from echoing back what you send.

Then, familiarize yourself with the AT commands provided by the ELM327, e.g. by reading https://www.elmelectronics.com/wp-content/uploads/2016/07/ELM327DS.pdf.

DrMickeyLauer
  • 4,455
  • 3
  • 31
  • 67