Pages: [1]
Author Topic: VW TP2.0 (CAN) + KWP2000  (Read 20595 times)
seishuku
Full Member
***

Karma: +13/-0
Offline Offline

Posts: 131


« on: October 23, 2015, 07:06:52 PM »

I'm trying to make my aux gauge display a little more flexible, which means going a little deeper with diagnostic modes to get more detailed data.

I can poll OBD2 data no problem, ISOTP works just fine... But when I open a channel and try to poll KWP2k data, I can get the first data set fine, but the ECU is tossing extra CAN frames and then disconnect me:

Code:
200h 7 01h C0h 00h 10h 00h 03h 01h // Request channel setup (module 01h, RX CAN ID 300h)
201h 7 00h D0h 00h 03h 40h 07h 01h // Response channel setup (module 01h, RX CAN ID 300h, TX CAN ID 740h)

740h 6 A0h 0Fh 8Ah FFh 32h FFh // Request timing parameters
300h 6 A1h 0Fh 8Ah FFh 4Ah FFh // Response timing parameters

740h 5 10h 00h 02h 10h 89h // startDiagnosticSession (param 89h)
300h 1 B1h                           // ECU Acknowledge
300h 5 10h 00h 02h 50h 89h // startDiagnosticSession positive response
740h 1 B1h                           // Tester Acknowledge

740h 5 11h 00h 02h 21h 01h // readDataByLocalIdentifier (parameter 01h)
300h 1 B2h                          // ECU Acknowledge
300h 8 21h 00h 1Ah 61h 01h 01h 73h 00h // More packets to follow, no ack, KWP2k data (positive response to readDataByLocalId)
300h 8 22h 27h 46h 00h 64h 50h 00h 05h // More packets to follow, no ack.
300h 8 23h 09h 80h 25h 02h 7Ah 25h 00h // More packets to follow, no ack.
300h 8 14h 00h 25h 00h 00h 25h 00h 00h // Last packet, expecting ack.
740h 1 B2h                          // Tester Acknowledge

300h 8 22h 27h 46h 00h 64h 50h 00h 05h // Repeat second packet
300h 8 14h 00h 25h 00h 00h 25h 00h 00h // Repeat third packet
300h 8 14h 00h 25h 00h 00h 25h 00h 00h // Repeat third packet
300h 8 14h 00h 25h 00h 00h 25h 00h 00h // Repeat third packet
300h 1 A8h                         // ECU disconnects

I'm sending data exactly how the docs say, it's also identical to how VCDS is doing it. I just don't get why I get a proper data block, then some junk and then disconnected.

I get this on both my Teensy 3.1 and STM32F429 discovery boards, so I'm pretty sure it's nothing hardware or a CAN driver issue.

Any ideas?
« Last Edit: October 23, 2015, 07:09:29 PM by seishuku » Logged
Basano
Full Member
***

Karma: +90/-3
Offline Offline

Posts: 192


« Reply #1 on: October 24, 2015, 12:33:56 AM »

Hi,

Your last ack should be B5h, not B2h Smiley Example below.

I assume you have the attached spec already, but it may help others as well.

Code:
19	200	7	1	C0	0	10	0	3	1	
21 201 7 0 D0 0 3 40 7 1
24 740 6 A0 F 8A FF 32 FF
31 300 6 A1 F 8A FF 4A FF
34 740 5 10 0 2 10 89
37 300 1 B1
44 300 5 10 0 2 50 89
46 740 1 B1
246 740 5 11 0 2 1A 9B
248 300 1 B2
254 300 8 21 0 30 5A 9B 31 4B 30
261 300 8 22 39 30 37 31 31 35 4C
267 300 8 23 20 20 30 30 33 30 10
272 300 8 24 0 0 0 0 6 46 22
278 300 8 25 4 F5 32 2E 30 6C 20
284 300 8 26 52 34 2F 34 56 20 54
290 300 8 27 46 53 49 20 20 20 20
296 300 2 18 20
1K0907115L  0030
1269
785
200
2.0l R4/4V TFSI     
301 740 1 B9
501 740 7 12 0 4 31 B8 0 0
503 300 1 B3
513 300 8 29 0 12 71 B8 1 1 1
519 300 8 2A 3 1 2 1 6 1 7
525 300 7 1B 1 8 1 D 1 18
527 740 1 BC
729 740 5 13 0 2 21 2
731 300 1 B4
738 300 8 2C 0 1A 61 2 1 C8 0
744 300 8 2D 21 85 85 16 FF 0 19
749 300 8 2E 0 0 25 0 0 25 4
756 300 8 1F 1D 25 2 7A 25 0 0
758 740 1 B0
958 740 5 14 0 2 21 71
960 300 1 B5
966 300 8 20 0 1A 61 71 1 C8 0
972 300 8 21 21 85 85 21 FF 13 12
978 300 8 22 7D CA 25 0 0 25 0
985 300 8 13 0 25 0 0 25 0 0
987 740 1 B4
1033 740 1 A3
1034 300 6 A1 F 8A FF 4A FF
1187 740 5 15 0 2 21 73
1189 300 1 B6
1195 300 8 24 0 1A 61 73 1 C8 0
1201 300 8 25 21 85 85 12 FA 1C 60
1207 300 8 26 64 65 36 14 A9 36 D
1213 300 8 17 9B 36 10 E9 36 E C3
1216 740 1 B8
Logged
seishuku
Full Member
***

Karma: +13/-0
Offline Offline

Posts: 131


« Reply #2 on: October 24, 2015, 06:37:34 AM »

So I'm supposed to count both my sequence AND the incoming?
I guess that would explain a lot... I'll have to try that.

Thanks!
Logged
seishuku
Full Member
***

Karma: +13/-0
Offline Offline

Posts: 131


« Reply #3 on: October 25, 2015, 04:48:22 PM »

Well, not quite counting incoming and outgoing sequences, more like the tester ack after the last data packet must follow the last sequence (eg. 0x13 last packet, 0xb4 ack).

The opposite is also true, tester outgoing data with 0x18 would get an ack of 0xb9.

It kinda makes sense to me now, but more importantly, I can stream in data now, continuously and without error.

https://www.youtube.com/watch?v=ltJswTSfDXM
https://www.youtube.com/watch?v=5rVMd0zYlgU
Logged
seishuku
Full Member
***

Karma: +13/-0
Offline Offline

Posts: 131


« Reply #4 on: October 31, 2015, 04:38:17 PM »

The end results:
https://www.youtube.com/watch?v=Mi4X8Rdz4GE
and source code, if anyone is interested:
https://github.com/seishuku/teensycanbusdisplay

Not really very different than my other setup with OBD2 PIDs, but with access to WAY more information.
Need to implement dynamicallyDefineLocalIdentifier, should help with display update rates (even though it's not too bad).
Logged
dream3R
Hero Member
*****

Karma: +18/-8
Offline Offline

Posts: 1194


« Reply #5 on: December 06, 2015, 08:57:08 PM »

Hi,

Your last ack should be B5h, not B2h Smiley Example below.

I assume you have the attached spec already, but it may help others as well.

Code:
19	200	7	1	C0	0	10	0	3	1	
21 201 7 0 D0 0 3 40 7 1
24 740 6 A0 F 8A FF 32 FF
31 300 6 A1 F 8A FF 4A FF
34 740 5 10 0 2 10 89
37 300 1 B1
44 300 5 10 0 2 50 89
46 740 1 B1
246 740 5 11 0 2 1A 9B
248 300 1 B2
254 300 8 21 0 30 5A 9B 31 4B 30
261 300 8 22 39 30 37 31 31 35 4C
267 300 8 23 20 20 30 30 33 30 10
272 300 8 24 0 0 0 0 6 46 22
278 300 8 25 4 F5 32 2E 30 6C 20
284 300 8 26 52 34 2F 34 56 20 54
290 300 8 27 46 53 49 20 20 20 20
296 300 2 18 20
1K0907115L  0030
1269
785
200
2.0l R4/4V TFSI     
301 740 1 B9
501 740 7 12 0 4 31 B8 0 0
503 300 1 B3
513 300 8 29 0 12 71 B8 1 1 1
519 300 8 2A 3 1 2 1 6 1 7
525 300 7 1B 1 8 1 D 1 18
527 740 1 BC
729 740 5 13 0 2 21 2
731 300 1 B4
738 300 8 2C 0 1A 61 2 1 C8 0
744 300 8 2D 21 85 85 16 FF 0 19
749 300 8 2E 0 0 25 0 0 25 4
756 300 8 1F 1D 25 2 7A 25 0 0
758 740 1 B0
958 740 5 14 0 2 21 71
960 300 1 B5
966 300 8 20 0 1A 61 71 1 C8 0
972 300 8 21 21 85 85 21 FF 13 12
978 300 8 22 7D CA 25 0 0 25 0
985 300 8 13 0 25 0 0 25 0 0
987 740 1 B4
1033 740 1 A3
1034 300 6 A1 F 8A FF 4A FF
1187 740 5 15 0 2 21 73
1189 300 1 B6
1195 300 8 24 0 1A 61 73 1 C8 0
1201 300 8 25 21 85 85 12 FA 1C 60
1207 300 8 26 64 65 36 14 A9 36 D
1213 300 8 17 9B 36 10 E9 36 E C3
1216 740 1 B8

Thank you squire
Logged



How to work out values from an A2L Smiley

http://nefariousmotorsports.com/forum/index.php?topic=5525.msg52371#msg52371


Starting Rev's http://nefariousmotorsports.com/forum/index.php?topic=5397.msg51169#msg51169

noobs read this before asking http://nefariousmotorsports.com/forum/index.php?topic=9014.0title=


ORGORIGINAL 05 5120 creator for Volvo
ORIGINAL Datalogger (Freeware) Author
ORGINAL finder of the 'extra' torque' limits
I don't have ME7.01 A2L I just use ID
dream3R
Hero Member
*****

Karma: +18/-8
Offline Offline

Posts: 1194


« Reply #6 on: December 06, 2015, 08:59:07 PM »

The end results:
https://www.youtube.com/watch?v=Mi4X8Rdz4GE
and source code, if anyone is interested:
https://github.com/seishuku/teensycanbusdisplay

Not really very different than my other setup with OBD2 PIDs, but with access to WAY more information.
Need to implement dynamicallyDefineLocalIdentifier, should help with display update rates (even though it's not too bad).

Which ECU/SW?   I might be able to help there.
Logged



How to work out values from an A2L Smiley

http://nefariousmotorsports.com/forum/index.php?topic=5525.msg52371#msg52371


Starting Rev's http://nefariousmotorsports.com/forum/index.php?topic=5397.msg51169#msg51169

noobs read this before asking http://nefariousmotorsports.com/forum/index.php?topic=9014.0title=


ORGORIGINAL 05 5120 creator for Volvo
ORIGINAL Datalogger (Freeware) Author
ORGINAL finder of the 'extra' torque' limits
I don't have ME7.01 A2L I just use ID
seishuku
Full Member
***

Karma: +13/-0
Offline Offline

Posts: 131


« Reply #7 on: December 08, 2015, 11:14:49 AM »

Which ECU/SW?   I might be able to help there.
Address 01: Engine (CJA)       Labels: 03L-906-022-CBE.clb
   Part No SW: 03L 906 019 HE    HW: 03L 907 309 AA
   Component: R4 2,0L EDC G000SG  4606 
   Revision: 12H14---    Serial number:               
   Coding: 0050072
   Shop #: WSC 00066 000 00000
   VCID: 75EAF8541C686D894D9-8020

I think I have most of it figured out, just haven't had the time to play with it yet.
Any help would be appreciated though.
Logged
dream3R
Hero Member
*****

Karma: +18/-8
Offline Offline

Posts: 1194


« Reply #8 on: December 08, 2015, 02:50:12 PM »

Address 01: Engine (CJA)       Labels: 03L-906-022-CBE.clb
   Part No SW: 03L 906 019 HE    HW: 03L 907 309 AA
   Component: R4 2,0L EDC G000SG  4606 
   Revision: 12H14---    Serial number:               
   Coding: 0050072
   Shop #: WSC 00066 000 00000
   VCID: 75EAF8541C686D894D9-8020

I think I have most of it figured out, just haven't had the time to play with it yet.
Any help would be appreciated though.

You have the identifiers?  If not what are you after and I'll get them Smiley

edit  Crap it's a VW I only got Audi stuff lol
« Last Edit: December 08, 2015, 02:56:33 PM by dream3R » Logged



How to work out values from an A2L Smiley

http://nefariousmotorsports.com/forum/index.php?topic=5525.msg52371#msg52371


Starting Rev's http://nefariousmotorsports.com/forum/index.php?topic=5397.msg51169#msg51169

noobs read this before asking http://nefariousmotorsports.com/forum/index.php?topic=9014.0title=


ORGORIGINAL 05 5120 creator for Volvo
ORIGINAL Datalogger (Freeware) Author
ORGINAL finder of the 'extra' torque' limits
I don't have ME7.01 A2L I just use ID
seishuku
Full Member
***

Karma: +13/-0
Offline Offline

Posts: 131


« Reply #9 on: December 08, 2015, 05:09:28 PM »

Oh, yeah, I have most localIDs for what I need for my specific engine, at least for what info I find useful.

Most data is pretty easy to figure out (especially when I can log CAN data from VCDS).  Grin
Logged
dream3R
Hero Member
*****

Karma: +18/-8
Offline Offline

Posts: 1194


« Reply #10 on: December 09, 2015, 03:48:00 AM »

Oh, yeah, I have most localIDs for what I need for my specific engine, at least for what info I find useful.

Most data is pretty easy to figure out (especially when I can log CAN data from VCDS).  Grin



LOL that's one way.  There's  generally a lot of stuff in the DB than VCDS uses fwiw.
Logged



How to work out values from an A2L Smiley

http://nefariousmotorsports.com/forum/index.php?topic=5525.msg52371#msg52371


Starting Rev's http://nefariousmotorsports.com/forum/index.php?topic=5397.msg51169#msg51169

noobs read this before asking http://nefariousmotorsports.com/forum/index.php?topic=9014.0title=


ORGORIGINAL 05 5120 creator for Volvo
ORIGINAL Datalogger (Freeware) Author
ORGINAL finder of the 'extra' torque' limits
I don't have ME7.01 A2L I just use ID
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #11 on: November 27, 2020, 05:01:55 PM »

So I know im resurrecting a dead thread but im hoping someone can shed some light on this.  Code calls the function:

Status+=CAN_VWKWP_GetValue(0x0B, 2, &Boost);

Which goes to:

int CAN_VWKWP_GetValue(uint8_t LocalID, uint8_t Index, float *Value)

I understand this is the readDataByLocalIdentifier with the 0x21 SID and described as:

The metric value of the data record defined by the local identifier $F0 is set by the DynamicalDefineLocalIdentifier service. The ReadDatabyLocalIdentifier service can also read other data records set in the ECU's internal table. Each local identifier has its own specific table that contains a description of the data to be transferred.

So what I dont understand is where were getting the Local ID and Index values.  Are these similar to the PID tables?  Also, would it be possible to use SID 0x23 for readMemoryByAddress along with the 0x38xxxx address to get really specific information?  Eventually I would also like to be able to add the SID 0x3D to be able to write RAM values.  But first, please help me know where the LocalID and Index values come from
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.029 seconds with 16 queries. (Pretty URLs adds 0.001s, 0q)