1

I am using a raspberry Pi and arduino CAN schield which is using a MCP2515 and SPI to request a single OBD II PID.

I am able to request and receive a single PID from my OBD emulator (Freematics). I know that is possible to request multiple PIDs (up to 6 PIDs) in a single query.

Whenever I use other kind of messages, I receive only the first request. Can anybody maybe help?

Here is the message for single PID which is working (C++):

msg.id = 0x7DF; //ID_QUERY
msg.header.rtr = 0;
msg.header.length = 0x08;
msg.data[0] = 0x02;
msg.data[1] = 0x01;
msg.data[2] = PID; //Whatever PID I want!

Message for multiple request that is not working:

msg.id = 0x7DF; //ID_QUERY
msg.header.rtr = 0;
msg.header.length = 0x08;
msg.data[0] = 0x07; //! Also it is not working with 0x08
msg.data[1] = 0x01;
msg.data[2] = PID0;
msg.data[3] = PID1;
msg.data[4] = PID2;
msg.data[5] = PID3;
msg.data[6] = PID4;
msg.data[7] = PID5;
mohsen_og
  • 774
  • 1
  • 9
  • 31

2 Answers2

1

Our Freematics OBD II emulator does not support sending multiple responses. One of our test vehicles, a 2010 Toyota corolla does. In our experience it is best to send a test command at startup to see if the device we're communicating with supports multiple responses or not. For our application we send the command 00 twice,

010000

If the response its greater than 25 characters, we know the device supports multiple commands as it responded to both 00 commands. If the response is less than 25 characters, we know the device responded to just the first 00 command and consequently only supports one command at a time. checking how many responses were received could be done multiple ways, but length has worked well for us so far.

Based on your use case, it may be enough to only send single commands. But if you really need the increased speed of multiple commands, add a check at start up to see if the device responds to multiple commands and then construct your messages based on the results. Dont forget to end your messages with the expected number of response lines to further increase speed. See the attached taken from: http://elmelectronics.com/DSheets/ELM327DS.pdf

enter image description here

  • Does Freematics OBD II not even support the VIN? It means that I only can get the first three characters of VIN through Freematics device? Am I right? – mohsen_og Jul 04 '16 at 11:51
  • Our Freematics OBD II does support vin. We retrieve it by sending the command "0902"... What do you mean by 'the first 3 characters of vin'?... what commands are you sending and what values are you getting in return? – Nicholas Ackerman Jul 04 '16 at 14:46
  • consider that I send and receive data through a c++ code with SPI and MCP2515. So what I send is 7DF as header and 02 09 02 as three bytes. (No. of data bytes, SID and PID). This is Okay. I receive 8 bytes with 7E8 header with 8 bytes of 10 14 49 02 01 57 50 4F. The problem is when I send the flow control of 7DF 30 00 00 00 00 00 00 00 I get no response anymore from ECU for the other fourteen bytes. – mohsen_og Jul 05 '16 at 08:46
  • hmmm, you may want to consider creating a new question to outline what appears to be a separate issue from the initial question... Im a little confused on what going on. Your response to 0902 should yield more than 8 bytes (see here: https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_09 - the expected bytes returned are 17-20), Id first look into figuring that out. When you send '7DF 30 00 00 00 00 00 00 00' are you attempting to get responses to PID '0100' multiple times? have you been able to successfully receive a single response to PID '0100'?... what did that command look like? – Nicholas Ackerman Jul 05 '16 at 14:57
0

Sending canbus messages through mcp2515 is a litle bit tricky.

First of all Freematics OBD Emulator support no multiple PID requests. Secondly, the multiple PID request should be sent with ISO 15765 format. when you send a multiple request, he ECU would response only with one "First Frame" message and will wait for the "Flow Control" message from the sender. After receiving the flow control, ECU will continue to sending the responses based on your flow control setting.

For more information about the CAN-Bus messages and how "First Frame" and "Single Frame" works, read the below links: googleBooks, ISO_15765-2, hackaday (dot) com

mohsen_og
  • 774
  • 1
  • 9
  • 31