PCAN_ISOTP invalid Mapping

A free API for the transfer of data packages according to ISO-TP (ISO 15765-2)
Post Reply
aismail
Posts: 5
Joined: Wed 25. Aug 2021, 12:40

PCAN_ISOTP invalid Mapping

Post by aismail » Fri 3. Sep 2021, 12:57

Hi,

I recently started using the PCAN ISOTP API but i really didn't get the mapping part and specifically its fields, so i have few questions about it :
  1. does the CAN ID means the peak can device's ID ? (like : 0xF9) and when specifying cantp_can_msgtype as PCANTP_CAN_MSGTYPE_EXTENDED should the CAN ID receive a value like (0x0000F9)?
  2. i didn't understand the use of the can_id_flow_ctrl, the flow control is sent by the receiver when it gets a First Frame message, why should have another ID ? why isn't the same ID as The CAN -ID?
  3. the cantp_netaddrinfo :to what source Address and Target Address fields correspond exactly ? if i want to establish communication between my PC and an ECU (id : 0x60) using a peak CAN device with ID 0xF9, what should i do ?
    i've been using an open source ISOTP driver , i simply affect an id and data to isotp structure (id : 0x18DA60F9) and it works fine, i didn't get the logic used in PCAN ISOTP API on IDs.
In my application i tried to initialize a mapping structure (inspiring from the samples of the API) and used the write function but i got error status with value 0x0EU and the write() failed
here is a part of my code:

Code: Select all

 
        CANStatus = CANTP_MsgDataAlloc_2016(&l_CANMsg, PCANTP_MSGTYPE_ISOTP);
        if (CANStatus != PCANTP_STATUS_OK)
        {
            output("CANTP MSG ALLOC  ERROR \n");

        }
        l_mapping.can_id = 0x0000F9;  
        l_mapping.can_id_flow_ctrl = 0x0000F9; 
        l_mapping.can_msgtype = PCANTP_CAN_MSGTYPE_EXTENDED; 
       
        l_mapping.netaddrinfo.extension_addr = 0x00;
        l_mapping.netaddrinfo.format = PCANTP_ISOTP_FORMAT_EXTENDED;
        l_mapping.netaddrinfo.msgtype = PCANTP_ISOTP_MSGTYPE_DIAGNOSTIC;
        l_mapping.netaddrinfo.source_addr = 0xF9;
        l_mapping.netaddrinfo.target_addr = 0x60;
        l_mapping.netaddrinfo.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
        CANTP_AddMapping_2016(m_DeviceConfig.usChannel, &l_mapping);
        CANTP_MsgDataInit_2016(&l_CANMsg, l_mapping.can_id, l_mapping.can_msgtype, in_stCANFrame.ucDataLength, &in_stCANFrame.pcData, &l_mapping.netaddrinfo);
        CANTP_Write_2016(m_DeviceConfig.usChannel, &l_CANMsg);
        
        
best.
Last edited by K.Wagner on Fri 3. Sep 2021, 13:13, edited 1 time in total.
Reason: Text formatting for better reading

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

Re: PCAN_ISOTP invalid Mapping

Post by K.Wagner » Fri 3. Sep 2021, 13:49

Hello,

please note that ISO-15765-2 (a.k.a. ISO-TP) is not a trivial protocol. It is a high layer protocol, which implies to have some knowledge about the norm and its usage. We encourage all users to first take a look at the ISO-15765-2 specifications and to study the help provided with the PCAN-ISO-TP package before starting a project from scratch. Now to your questions:
  1. ISO-TP doesn't care about the "physical" device you are using. The "CAN ID", is mean to be ID the API should use for outgoing CAN frames.
  2. Analog to "CAN ID", this is the (CAN) ID used by the other participant (e.g. ECU) for its outgoing CAN frames. The API needs to know this in order to recognize and accept incoming frames.
    As it can be read in the help file:
    can_id_flow_ctrl: CAN ID used for the flow control frame (frame, transmitted by the receiver of an ISO-TP message, that provides
    communication information).
  3. "Source Address" and "Target Address" are identification bytes used in ISO-TP (see document ISO-15765-2 for more information). These values are part of the ISO-TP norm and for informative purpose. They are not checked when sending / receiving CAN frames.
A brief explanation of the ISO-TP networking can be found in the chapter 4.4. ISO-TP Network Addressing Format within the API documentation (page 259).

If you have more than one channel at your disposal, you can use the sample "06_isotp_segmented_read_write" to see how two nodes communicate and to check the mapping used for it.
Best regards,
Keneth

Post Reply