I have an application where we have standard CAN Messages (normally to be sent via PCAN Basic) and CAN Messages with ISO-TP embedded (to be sent via PCAN-ISO TP).
I found out that either PCAN Basic can initialize the channel or PCAN-ISO TP and not both of them.
My question is: If I am initialized with PCAN-ISO TP, how can I send a message using the underlying PCAN Basic library?
Thanks for your advice
If you want to send raw CAN messages and ISO-TP messages over the same connection, you have two possibilities:
- You send CAN messages using PCAN-ISO-TP too: you need to set the FORMAT member (TPCANTPFormatType) of the TPCANTPMsg structure to the value CANTP_FORMAT_NONE (see help, page 29). Use then CANTP_Write for sending it.
- You use PCAN-Basic for sending the messages: Just use the ISO-TP channel handle with the CAN_Write function of PCAN-Basic. Please look at the following topic for detailed information: Mixing RX/TX of normal CAN framesand ISO-TP messages
Ok that is indeed great flexibility in terms of SENDING.
But I didn´t mention that for sure we need to receive standard CAN frames also.
So because luckily the information we have to read back via diagnostic UDS/ISO-TP channel is small, usually a single
ISO-TP frame does the job, therefore I will forget about ISO-TP library and will interpret the CAN frames manually using PCAN Basic.
In the beginning of a project it is essential to know the right way to go.
Thanks for your detailed reply
I understood you wanted only to send raw CAN messages. If you want to send and receive raw CAN messages within PCAN-ISO-TP this is also possible. You need to set the parameter PCANTP_PARAM_CAN_UNSEGMENTED to the value PCANTP_CAN_UNSEGMENTED_ON (see the help file, page 38). Using this the PCAN-ISO-TP Api will allow reading raw CAN messages over CANTP_Read. The only tedious thing is that you have to code/decode always the CAN-ID, since this is coded in the Data field of the CANTP message (see sample in the help file, page 30).
Nevertheless, remember that in order to use PCAN-Basic for read the same information you get over PCAN-ISO-TP, you will need a second channel, as described in the linkt I gave you in my last post. You cannot use the same channel for read from both APIs at the same time.