CAN ISO-TP mapping error
CAN ISO-TP mapping error
Hello,
I am trying to implement CAN TP_ISO diagnose using a PCAN-USB FD interface.
I am getting an error on second mapping call.
Up to there everything is OK.
I have following code:
...
Byte N_SA = 0x01;
Byte N_TA_PHYS = 0x02;
Byte N_RA = 0x00;
pCANChannel = PCANTP_USBBUS1;//first channel of USB interface
pBaudRate = PCANTP_BAUD_500K ;
status = pCANTP_Initialize(pCANChannel, pBaudRate);
status = pCANTP_Reset(pCANChannel);
status = pCANTP_AddMapping(pCANChannel, 0x770, 0x710, PCANTP_ID_CAN_11BIT, PCANTP_FORMAT_NORMAL, PCANTP_MESSAGE_DIAGNOSTIC, N_TA_PHYS, N_SA, PCANTP_ADDRESSING_PHYSICAL, 0x00);
status = pCANTP_AddMapping(pCANChannel, 0x710, 0x770, PCANTP_ID_CAN_11BIT, PCANTP_FORMAT_NORMAL, PCANTP_MESSAGE_DIAGNOSTIC, N_SA, N_TA_PHYS, PCANTP_ADDRESSING_PHYSICAL, 0x00);
status is 2 after second addmapping call, 0 for all previous calls.
I apreciate any sugestions.
Thank you !
I am trying to implement CAN TP_ISO diagnose using a PCAN-USB FD interface.
I am getting an error on second mapping call.
Up to there everything is OK.
I have following code:
...
Byte N_SA = 0x01;
Byte N_TA_PHYS = 0x02;
Byte N_RA = 0x00;
pCANChannel = PCANTP_USBBUS1;//first channel of USB interface
pBaudRate = PCANTP_BAUD_500K ;
status = pCANTP_Initialize(pCANChannel, pBaudRate);
status = pCANTP_Reset(pCANChannel);
status = pCANTP_AddMapping(pCANChannel, 0x770, 0x710, PCANTP_ID_CAN_11BIT, PCANTP_FORMAT_NORMAL, PCANTP_MESSAGE_DIAGNOSTIC, N_TA_PHYS, N_SA, PCANTP_ADDRESSING_PHYSICAL, 0x00);
status = pCANTP_AddMapping(pCANChannel, 0x710, 0x770, PCANTP_ID_CAN_11BIT, PCANTP_FORMAT_NORMAL, PCANTP_MESSAGE_DIAGNOSTIC, N_SA, N_TA_PHYS, PCANTP_ADDRESSING_PHYSICAL, 0x00);
status is 2 after second addmapping call, 0 for all previous calls.
I apreciate any sugestions.
Thank you !
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: CAN ISO-TP mapping error
Hello,
I've just tried your code and it works without any error with the latest version of the API.
Please check that you are using the latest version of PCAN-ISO-TP API: v2.0.2.102.
I've just tried your code and it works without any error with the latest version of the API.
Please check that you are using the latest version of PCAN-ISO-TP API: v2.0.2.102.
Best regards,
Fabrice
Fabrice
Re: CAN ISO-TP mapping error
Hello,
Thank you for the reply.
In original code I had a few other lines between the function calls but even with the code cleaned up and only function calls remaining I still get the status = 2 after the second mapping function call and the led on the interface is blinking red.
I use PCAN-ISO-TP v2.0.2.102 and PCANBasic version 4.3.0.150 with Borland C++ Builder on Win7.
I have a PCAN-USB FD interface with 2.3.1 firnware and 4.1.4.16279 driver version.
Any other possible causes or suggestions ?
Thank you for the reply.
In original code I had a few other lines between the function calls but even with the code cleaned up and only function calls remaining I still get the status = 2 after the second mapping function call and the led on the interface is blinking red.
I use PCAN-ISO-TP v2.0.2.102 and PCANBasic version 4.3.0.150 with Borland C++ Builder on Win7.
I have a PCAN-USB FD interface with 2.3.1 firnware and 4.1.4.16279 driver version.
Any other possible causes or suggestions ?
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: CAN ISO-TP mapping error
The function CANTP_AddMapping returns the error code PCANTP_ERROR_ALREADY_INITIALIZED (err=2) on those conditions only:
- the channel is not initialized. This seems unlikely since your previous call to CANTP_Addmapping succeeded.
- the new mapping corresponds to an already defined mapping: in your case (a diagnostic message using Normal addressing), the function only checks that the CAN ID (0x710) is not used by a previously defined mapping.
Also note that a blinking red LED on a PCAN-USB FD device indicates that you're having CAN Bus error. An initialized channel with status "OK" bus should have a green blinking LED.
- the channel is not initialized. This seems unlikely since your previous call to CANTP_Addmapping succeeded.
- the new mapping corresponds to an already defined mapping: in your case (a diagnostic message using Normal addressing), the function only checks that the CAN ID (0x710) is not used by a previously defined mapping.
Also note that a blinking red LED on a PCAN-USB FD device indicates that you're having CAN Bus error. An initialized channel with status "OK" bus should have a green blinking LED.
Best regards,
Fabrice
Fabrice
Re: CAN ISO-TP mapping error
Hello,
The versions you are using (driver, firmware, APIs) are OK. A red Led means, as Fabrice already wrote, that CAN errors are being generated because of sending messages...:
As Fabrice did, I also tested the mappings you mentioned and I can set them without a problem. Could you try to do this with any of the example projects that are shipped with the ISO-TP package? Please set the mappings with it and try to do communication. Here a picture of how they look at my computer:
The versions you are using (driver, firmware, APIs) are OK. A red Led means, as Fabrice already wrote, that CAN errors are being generated because of sending messages...:
- ...in an open network (no other participant)
- ...using a bit rate that differs from the bit rate of other participant(s)
- ...using a not well terminated connection.
As Fabrice did, I also tested the mappings you mentioned and I can set them without a problem. Could you try to do this with any of the example projects that are shipped with the ISO-TP package? Please set the mappings with it and try to do communication. Here a picture of how they look at my computer:
Best regards,
Keneth
Keneth
Re: CAN ISO-TP mapping error
It's strange.
I used the PCANIsoTP CLR example for VS and it works normally, as it should. I can send requests and get responses from ECU.
I checked with debug the parameters values for the AddMapping function and they are identical to the values I have in C++ Builder call.
However I still get an error on second mapping call in C++ Builder.
I suspect it's a Builder issue since it's an old version (v5.0).
I used the PCANIsoTP CLR example for VS and it works normally, as it should. I can send requests and get responses from ECU.
I checked with debug the parameters values for the AddMapping function and they are identical to the values I have in C++ Builder call.
However I still get an error on second mapping call in C++ Builder.
I suspect it's a Builder issue since it's an old version (v5.0).
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: CAN ISO-TP mapping error
Maybe any Byte Allingment settings in BB5 ? I remember that we had such problems when we use the BB4/5 Versions in the past.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: CAN ISO-TP mapping error
I tried all C++ Builder settings for byte alignment but still no luck.
I removed a mapping and left only one to see if I can get to message sending even without response.
status = pCANTP_AddMapping(PCANTP_USBBUS1, 0x710, 0x770, PCANTP_ID_CAN_11BIT, PCANTP_FORMAT_NORMAL, PCANTP_MESSAGE_DIAGNOSTIC, N_SA, N_TA, PCANTP_ADDRESSING_PHYSICAL, N_RA);
status is 0 after call but the led turns red and begins flashing the moment the function is called.
I removed a mapping and left only one to see if I can get to message sending even without response.
status = pCANTP_AddMapping(PCANTP_USBBUS1, 0x710, 0x770, PCANTP_ID_CAN_11BIT, PCANTP_FORMAT_NORMAL, PCANTP_MESSAGE_DIAGNOSTIC, N_SA, N_TA, PCANTP_ADDRESSING_PHYSICAL, N_RA);
status is 0 after call but the led turns red and begins flashing the moment the function is called.
Re: CAN ISO-TP mapping error
As I said in a previous post, red lightning means communication problems. Please activate the debug log of PCAN-Basic (check this post).
It will be generated in the same folder of the calling process. In there you can check if the bit rate used is correct. You also will see the raw CAN messages being sent from ISO-TP Api.
It will be generated in the same folder of the calling process. In there you can check if the bit rate used is correct. You also will see the raw CAN messages being sent from ISO-TP Api.
Best regards,
Keneth
Keneth