11-bit PCAN Client's mapping fails to filter out 29-bit CAN msgs (Python)

A free API for the transfer of data packages according to ISO-TP (ISO 15765-2)
Post Reply
hariranpariya1990@gmail.com
Posts: 1
Joined: Tue 21. Jul 2020, 03:14

11-bit PCAN Client's mapping fails to filter out 29-bit CAN msgs (Python)

Post by hariranpariya1990@gmail.com » Tue 21. Jul 2020, 03:54

My CAN Request & Response IDs for 11-Bits communication:
  • "request_id": "7F4",
  • "response_id": "7F5"
Below configuration I have used in my client application (Python script)

Code: Select all

status = self.iso_tp_lib.CANTP_AddMapping(self.pcan_channel, self.txid, self.rxid,
                                          PCANTP_ID_CAN_11BIT, PCANTP_FORMAT_NORMAL, PCANTP_MESSAGE_DIAGNOSTIC,
                                          N_SA, N_TA_PHYS, PCANTP_ADDRESSING_PHYSICAL, N_RA)

status = self.iso_tp_lib.CANTP_AddMapping(self.pcan_channel, self.rxid, self.txid,
                                          PCANTP_ID_CAN_11BIT, PCANTP_FORMAT_NORMAL, PCANTP_MESSAGE_DIAGNOSTIC,
                                          N_TA_PHYS, N_SA, PCANTP_ADDRESSING_PHYSICAL, N_RA)


When I am requesting readByDataIdentifier (0xCF99) from my client application I am getting below error:

Code: Select all

[InvalidResponseException] : service execution returned an invalid response. Reason : Payload first byte is not a know service response ID.
ERROR: service execution returned an invalid response. Reason : Payload first byte is not a know service response ID.

CAN traces with 11-bits & (extended) 29-bits msgs (ECU sends both types of msgs 11-bits & 29-bits but client is only configured for 11-bits CAN msg for sen & receive)
8896) 21042.0 Rx 07F4 8 03 22 CF 99 55 55 55 55 // ReadByDataIndetifier request
8897) 21042.3 Rx 17A00000 8 02 00 02 00 02 00 02 00
8898) 21042.5 Rx 17B00000 4 02 00 02 00 // It consider this as a response and give us error -- see below for more details
8899) 21042.8 Rx 16000000 6 00 00 00 00 00 00
8900) 21043.2 Rx 16200000 8 00 00 00 00 00 00 00 00
8901) 21043.5 Rx 16300000 8 00 00 00 00 00 00 00 00
8902) 21043.7 Rx 07F5 8 03 7F 22 31 55 55 55 55 // ReadByDataIndetifier correct response
Actually, error represents that it doesn't able to find 0x7F as a first byte from the CAN msg payload and that is why it discards the package. But the client receives 29-bits CAN msg payloads (0x00 0x02) even it configured for 11-bits CAN msgs only. You can see it in below image. This issue frequently occurs every certain request from the client (Not at fix rate). Sometime it takes time to reproduce.

Function calling sequence from my client application

Code: Select all

i) send_request()
	response = Response.from_payload(payload)

ii) python -> Lib -> site-packages -> udsoncan -> exceptions.py -> from_payload() 
	 if payload[0] != 0x7F:	# Positive
	    response.service = services.cls_from_response_id(payload[0])
	    if response.service is None:
	        response.valid = False
	        response.invalid_reason = "Payload first byte is not a know service response ID."
	        return response
My PCAN libraries' version:
  • PCANBasic.dll -> 4.3
  • PCAN-ISO-TP.dll -> 2.0
Please guide me to find out the root cause of it. Feel free to let me know if I am doing any mistake above.

Thank you in advance!!

K.Wagner
Software Development
Software Development
Posts: 767
Joined: Wed 22. Sep 2010, 13:36

Re: 11-bit PCAN Client's mapping fails to filter out 29-bit CAN msgs (Python)

Post by K.Wagner » Tue 21. Jul 2020, 10:24

Hello,

this is normal that your receive those 29-bit frames. PCAN-ISO-TP is configured like that. You can see this in the chapter 4.4 of the documentation for PCAN-ISO-TP v2.x (page 116):
ISO-TP_Mappings.PNG
ISO-TP_Mappings.PNG (79.96 KiB) Viewed 479 times
Note that there are no mappings needed in order to receive FIXED_NORMAL or MIXED 29-bit messages.

If you don't want to receive these messages you have two possible ways to go:
  1. Either you will need to discard these messages by yourself (just check and ignore messages with message type PCANTP_ID_CAN_29BIT),
  2. or you upgrade your project to the new PCAN-ISO-TP version 3.0, which allows disabling those messages using the function CANTP_SetValue_2016, and the parameters
    • PCANTP_PARAMETER_SUPPORT_29B_ENHANCED = 0x11B
    • PCANTP_PARAMETER_SUPPORT_29B_FIXED_NORMAL = 0x11C
    • PCANTP_PARAMETER_SUPPORT_29B_MIXED = 0x11D
Best regards,
Keneth

Post Reply