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'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: v126.96.36.199.
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 v188.8.131.52 and PCANBasic version 184.108.40.206 with Borland C++ Builder on Win7.
I have a PCAN-USB FD interface with 2.3.1 firnware and 220.127.116.1179 driver version.
Any other possible causes or suggestions ?
- 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 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:
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).
Technical Support Team
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.
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.