Torque

Forums

Forums

Guest  

Show or hide header
Welcome Guest, posting in this forum require registration.




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » Extract data from multi-line / multi-byte CAN response

Pages: [1] 2
Author Topic: Extract data from multi-line / multi-byte CAN response
anko
Member
Posts: 143
Post Extract data from multi-line / multi-byte CAN response
on: June 25, 2015 (GMT)

When I request mode 21, pid 01 from address 765, I get this total picture:

765 02 21 01
766 10 17 61 01 00 00 07 45
765 30 08 0A
766 21 00 00 00 02 CC 4C 00
766 22 00 0B 12 79 03 A3 98
766 23 00 5F 00 FF FF FF FF

For example, data bytes 4, 5 and 6 on the second response line combined together (02 CC 4C) mean something to me. Can I extract these and calculate (((0x02 * 256) + 0xCC) * 256 + 0x4C) to get the value I need via a Custom PID definition? And can Torque Pro take care of sending the flow control message (765 30 08 0A) after receiving the first line of response data? If that is not sent, all I get is the first line of response.

Thanks!

moreause
Member
Posts: 637
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

in my case torque is managing the flow control

to put these data into your formula you do as normal

A is the first data B next C D ect

you go up until you data and put that into the forumula

if you not sure exactly of the letter

just put a letter and the formula and watch what is the value and see where it fits

moreause
Member
Posts: 637
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

here is my exemple

just not sure about your 765

s mine

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

Cool. Highly appreciate your fast response.

When I quickly tried that, in test mode it would only show the first line of responses 0:XX XX XX XX …. It did not show 1:XX XX XX XX … etc.

It would display the message length correctly in terms, though ….

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

It is for a Mitsubishi though. So it could be MUT related. I saw an old post from 2012 regarding this. Is MUT supported now?

Thanks.

cintakc
Member
Posts: 1661
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

You will not see the second line of the response, as it is necessary translate the adapter in the mode Flow Control
initialization string:

atz\natsp6\natsh765\natfcsd30080A\natfcsm1\natcra766\n1092

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

Thanks! Great info. I am just not sure about the 1092 at the end. Would that have to be replaced with my mode and pid?

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

Is it correct that the 1092 is a specific request that would put the ECU in a specific diagnostic mode (Request = mode 10, pid 92)?

I wonder if I need that, as I do get the first response for my original request. Just not the second, third, … etc.

Thanks.

cintakc
Member
Posts: 1661
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

1092 – open session, it’s not obligatory
1 byte after 6101 response – formula A,
2 – B
3 – C

exemple:

765 02 21 01
766 10 17 61 01 00 00 07 45
765 30 08 0A
766 21 00 00 00 02 CC 4C 00
766 22 00 0B 12 79 03 A3 98
766 23 00 5F 00 FF FF FF FF

765 02 21 01
response:

 61 01 00 00 07 45 00 00 00 02 CC 4C 00 00 0B 12 79 03 A3 98 00 5F 00 FF FF FF FF

00-A
00-B
07-C
45-D
….
02-H

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

I assumed the init string went into the Diagnostic Start Command field, but that doesn’t seem to do anything for me. Any suggestions?

Thanks,

Anko

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 26, 2015 (GMT)

If I may add to my own misery ….. 😉

Even without flow control working, I am able to use data bytes A, B, C and D as they are all on the first line returned by the ECU.

I have added one custom PID for ECU 761, another for ECU 763 and another for ECU 765. In Test mode, all PID’s work fine separately, but in a dashboard, all PID’s are calculated from the response of one single ECU.

I totally understand that you cannot combine data bytes from single ECUs into a single PID, but I was hoping it would be possible to combine PIDs based upon different ECU’s into single dashboards?

All I did was add the ECU address into the OBD HEADER field.

Thanks!

moreause
Member
Posts: 637
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

i’m not sure i understand what you are saying

but i will say this…you can add 2 or more value into one PID

like in my exemple the 33 between square bracket is baro pressure value is coming from another pid

cintakc
Member
Posts: 1661
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

when you create a custom PID after equation
in the Header add address for each a particular block

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

Moreause, can you explain how that [33] works? What does 33 refer to in this example? Is it a PID defined in TP earlier? Or will it result in a separate request to the ECU? Thanks, Anko
Quote from moreause on June 27, 2015
i’m not sure i understand what you are saying

but i will say this…you can add 2 or more value into one PID

like in my exemple the 33 between square bracket is baro pressure value is coming from another pid

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

Thanks a lot, guys.

Let me try to explain this way. I have created a custom PID csv file that looks like below. This is for a Mitsubishi Outlander PHEV, that has two E-motors driving the front and rear axles, a generator to generate electricity, and more:

Name,ShortName,ModeAndPid,Equation,Min Value,Max Value,Units,Header
Front Motor Torque Request,FMTqReq,2101,A*256+B,-200,200,Nm,755
Front Motor Torque,FMTorque,2102,A*256+B,-200,200,Nm,755
Rear Motor Torque Request,RMTqReq,2101,A*256+B,-200,200,Nm,753
Rear Motor Torque,RMTorque,2102,A*256+B,-200,200,Nm,753
Generator Torque Request,GenTqReq,2101,A*256+B,-200,200,Nm,73C
Generator Motor Torque,GenTorque,2102,A*256+B,-200,200,Nm,73C
SOC Percentage Controller,SOC%Ctrl,2101,A/2-5,0,100,%,761
SOC Percentage Display,SOC%Disp,2101,B/2-5,0,100,%,761
Cell Voltage #01,CellVolt#01,2102,(A*256+B)/1000,3,4.50,V,761
Charge Count 100V,ChgCnt100,2102,A*256+B,0,10000,,765
Charge Count 200V,ChgCnt200,2102,C*256+D,0,10000,,765

I can import the file just fine. But for now I have two issues with it.

First of all I have not been able to deal with the flow control issue, yet. So for each request, I only see the first response. As a result, I can only access A, B, C and D and not the remainder of the payload (this is why I have a very limited PID file, for now).

cintakc suggeted using an init string, for example for the last two custom PIDs:

atz\natsp6\natsh765\natfcsd30080A\natfcsm1\natcra766\n1092

What I do understand is this:
– atz
– atsp6
– atsh765
– atfcsd30080a
– atfcsm1

What I do not understand is:
– Where to put it? Does it go into the Diag Start Command?
– If so, do I need to provide a Diag Stop Command?
– What is the purpose of atcra766? TP is not going to issue an atma command, right? So, why set up a filter?
– What is the purpose of 1092? cintakc already set it was not mandatory

Either way, I have tried several variations as a Diag Start Command, and neither seem to have an effect on the result I get back. I always get that one line. When I use telnet to talk to the ELM327, I do manage to enable auto flow control and I can get the full response that way. Simply by setting atsh765, atfcsd30080a and atfcsm1. So, I cannot be that far off.

There second problem I have is this. In test mode above custom PIDs work fine. When testing the “Front Motor Torque” PID, I get 10.000 Nm (still need to work on my formula). When testing the “Cell Voltage #01” PID, I get 4,05 volts. That’s also fine. But when I combine them into one single dashboard, I get 10.000 Nm for the first, and 10 Volts for the second. So apparently, for both custom PIDs, A*256+B is 10.000. But also, when I add the “Rear Motor Torque” and “Generator Motor Torque” PIDs, they all use the same input value of 10.000. When I press the accelerator of the car, to request power from the front motor, all PIDs go up with the same amount. It looks as if TP is not sending the correct header every time, and is using the same header (or device address) for each custom PID.

If somebody could help me out with setting this straight, I would appreciate it a lot …. Thanks,

Anko

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

Small update:

I have managed to connect TP to my ELM327 and in the mean time listen in on the traffic using a telnet session on my laptop. I see all the response come by.

I can actually insert additional commands to some extend. I have added the relevant at fc xx commands, while testing a specific PID. When I do so, I actually see the full response appear in TP !!

So, TP can receive the full responses, but somehow there is a problem in setting the proper fc commands from within TP.

Capp777
Member
Posts: 2993
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

Look in the vehicle profile for the
custom init string field. I believe this
is where your string should go.

The diagnostic start/stop fields in the
pid editor are experimental and should
not be used for your purpose.

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

Ah, thanks! I completely missed that. But doesn’t that mean that I cannot use different flow control headers for different PID’s?

Capp777
Member
Posts: 2993
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

Im not familiar with your protocol but
I would think you specify the specific
module in the pid header field.

anko
Member
Posts: 143
Post Re: Extract data from multi-line / multi-byte CAN response
on: June 27, 2015 (GMT)

Thanks for staying with me.

This is correct. But in order to activate flow control, I need to specify to which ECU / header to send the flow control characters, by submitting “at fc sh ” and this will be different for each ECU.

When “af tc sh ” is specified at vehicle level, rather than at custom pid level, I cannot enable flow control for all ECU’s.

Pages: [1] 2
WP-Forum by: Fredrik Fahlstad, Version: 2.4
Page loaded in: 0.065 seconds.

  Follow me on twitter