[Ovmsdev] Poller support for VW TP 2.0

Michael Balzer dexter at expeedo.de
Mon May 31 05:00:29 HKT 2021

Everyone interested in VW/VAG vehicles: I've added a first 
implementation of the VW TP 2.0 protocol in the vehicle poller.

I've pushed this to a new branch for testing: 

This includes refactoring the ISO TP engine into a separate module, so 
may introduce bugs with that. Please do not introduce larger changes in 
the master poller code until we've tested and merged this change.

The VW TP 2.0 engine is based on the explanation by Jared Wiltshire 
(https://jazdw.net/tp20) plus some observations & tests I've made with 
my Seat Mii.

I've added a text version of Jared's page in the vehicle docs folder:

VW TP 2.0 polls integrate seamlessly into an existing poller list and 
can also be sent as single OBD requests. Quoting from vehicle.h:

// VWTP_20: this protocol implements the VW (VAG) specific "TP 2.0", 
which establishes
// OSI layer 5 communication channels to devices (ECU modules) via a CAN 
// On VWTP_20 poll entries, simply set the TXID to the gateway base ID 
(normally 0x200)
// and the RXID to the logical 8 bit ECU ID you want to address.
// TP 2.0 transports standard OBD/UDS requests, so everything else works 
the same way
// as with ISO-TP.
// VW TP 2.0 poll entry examples:
//   // TXID, RXID,  TYPE,    PID,      TIMES,  BUS,  PROT
//   { 0x200, 0x1f,  0x10,   0x89,  {…times…},    0,  VWTP_20 }
//   { 0x200, 0x1f,  0x22, 0x04a1,  {…times…},    0 , VWTP_20 }
// VW gateways currently do not support multiple open channels. To 
minimize connection
// overhead for successive polls to an ECU, the VWTP_20 engine keeps an 
idle connection open
// until the keepalive timeout occurs. So you should try to arrange your 
polls in interval
// blocks/sequences to the same devices if possible.
// To explicitly close a VWTP_20 channel, send a poll (any type) to RXID 
0, that just
// closes the channel (ECU ID 0 is an invalid destination):
//   { 0x200,    0,     0,      0,  {…times…},    0 , VWTP_20 }

To manually send a request, use the "-v" option on the OBD request 
command to select VW TP 2.0, e.g.:

OVMS# obd can1 req dev -v 200 1f 22f197
200[1f] 22f197: Response:
47 57 2d 4b 2d 43 41 4e 20 54 50 32 30          | GW-K-CAN TP20

To manually close a channel from the shell, issue:

OVMS# obd can1 req dev -v 200 00 0000

Feedback, code audits & tests are welcome.

If you encounter errors or misbehaviour, please send me a debug log 
including the CAN range 200-3ff:

OVMS# log level debug vehicle-vwtp
OVMS# can log start monitor crtd 200-3ff


Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20210530/4dfc3674/attachment.sig>

More information about the OvmsDev mailing list