Hi,
i am facing regarding address mapping,
I am using normal address mode, so for can ISO tp side I configured as below
Code: Select all
int main()
{
// Local variables
cantp_status res;
cantp_msg tx_msg, rx_msg, crc_msg;
cantp_mapping mapping;
cantp_handle client_handle;
uint32_t opt;
cantp_mapping reverse_mapping;
// Initialize structs
client_handle = PCANTP_HANDLE_USBBUS1; // TODO: modify the value according to your available PCAN devices.
memset(&tx_msg, 0, sizeof(cantp_msg));
memset(&mapping, 0, sizeof(cantp_mapping));
memset(&reverse_mapping, 0, sizeof(cantp_mapping));
memset(&crc_msg, 0, sizeof(cantp_msg));
//noram address mapping
mapping.can_id = 0xA1;
mapping.can_id_flow_ctrl = 0xA2;
mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
mapping.can_tx_dlc = 0x0; //NA
mapping.netaddrinfo.extension_addr = 0x00; //NA
mapping.netaddrinfo.format = PCANTP_ISOTP_FORMAT_NORMAL; //normal addressing mode
mapping.netaddrinfo.msgtype = PCANTP_ISOTP_MSGTYPE_DIAGNOSTIC;
mapping.netaddrinfo.source_addr = 0xF1;
mapping.netaddrinfo.target_addr = 0x01;
mapping.netaddrinfo.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
// Create the associated reversed mapping:
reverse_mapping = mapping;
reverse_mapping.can_id = mapping.can_id_flow_ctrl;
reverse_mapping.can_id_flow_ctrl = mapping.can_id;
reverse_mapping.netaddrinfo.source_addr = mapping.netaddrinfo.target_addr;
reverse_mapping.netaddrinfo.target_addr = mapping.netaddrinfo.source_addr;
// Initialize channels: CAN2.0 - 500Kbit/s
res = CANTP_Initialize_2016(client_handle, BAUDRATE, (cantp_hwtype)0, 0, 0);
printf("Initialize: %s\n", STATUS_OK_KO(res));
// Add mappings on channels
res = CANTP_AddMapping_2016(client_handle,&mapping);
res = CANTP_AddMapping_2016(client_handle, &reverse_mapping);
configuretimeout(client_handle);
CanISOTPCallback();
configuretimeout(client_handle);
uint8_t buff[1000];
for (int i = 0; i < 1000; i++)
{
buff[i] = 0x01;
}
SendISOTPData(client_handle, &mapping, buff, 100);
while (1)
{
}
}
//function definition
uint32_t SendISOTPData(cantp_handle client_handle, cantp_mapping* mapping, uint8_t* buff, uint32_t len)
{
cantp_msg tx_msg;
cantp_status res;
res = CANTP_MsgDataAlloc_2016(&tx_msg, PCANTP_MSGTYPE_ISOTP);
//printf("Allocate SendISOTPData tx_msg message: %s\n", STATUS_OK_KO(res));
//res = CANTP_MsgDataInitOptions_2016(&tx_msg, 1);
//printf("Set message priority option: %s\n", STATUS_OK_KO(res));
res = CANTP_MsgDataInit_2016(&tx_msg, mapping->can_id, mapping->can_msgtype, len, buff, &mapping->netaddrinfo);
res = CANTP_Write_2016(client_handle, &tx_msg);
Sleep(20);
// Free message space
res = CANTP_MsgDataFree_2016(&tx_msg);
//printf("Free SendISOTPData tx_msg message: %s\n", STATUS_OK_KO(res));
return res;
}
i will read data through callback method, but when i try to send more than 8 bytes iam facing timeout problem.
Mapping 1: From tester (e.g., 0xA1) to ECU (e.g., 0xA2) – Used for sending initial requests.
Mapping 2: From ECU (e.g., 0xA2) to tester (e.g., 0xA1) – Used for receiving responses.
By above mapping i am able to read the bytes from ECU, but i couldn't able to send more than 8byes from Tester to ECU.
what is configuration problem
Regards,
Sandeep C