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 :
- 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)?
- 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?
- 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.
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);