I can able to receive and transmit the frame, through callback function.
But when i try to read the data from ECU i could not able to read the same data in polling method.
CAN ISO TP configuration:
Code: Select all
uint32_t ISOTP_init(cantp_mapping *mapping, cantp_handle client_handle, cantp_msg *tx_msg, cantp_msg* crc_msg)
{
char version_buffer[500];
cantp_status res;
// Print version informations
CANTP_GetValue_2016(PCANTP_HANDLE_NONEBUS, PCANTP_PARAMETER_API_VERSION, version_buffer, 500);
printf("PCAN-ISO-TP API Version: %s\n\r", version_buffer);
// Initialize channels: CAN2.0 - 500Kbit/s
res = CANTP_Initialize_2016(client_handle, PCANTP_BAUDRATE_125K, (cantp_hwtype)0, 0, 0);
printf("Initialize: %s\n", STATUS_OK_KO(res));
// Change STmin value to 600us
// Allocate tx message
res = CANTP_MsgDataAlloc_2016(tx_msg, PCANTP_MSGTYPE_ISOTP);
printf("Allocate tx message: %s\n\r", STATUS_OK_KO(res));
res = CANTP_MsgDataAlloc_2016(crc_msg, PCANTP_MSGTYPE_ISOTP);
printf("Allocate crc_msg message: %s\n\r", STATUS_OK_KO(res));
// Set priority (add message options)
res = CANTP_MsgDataInitOptions_2016(tx_msg, 1);
tx_msg->msgdata.any->options->buffer[0].name = PCANTP_OPTION_J1939_PRIORITY;
tx_msg->msgdata.any->options->buffer[0].value = 0x02;
printf("Set message priority option: %s\n\r", STATUS_OK_KO(res));
res = CANTP_MsgDataInitOptions_2016(crc_msg, 1);
crc_msg->msgdata.any->options->buffer[0].name = PCANTP_OPTION_J1939_PRIORITY;
crc_msg->msgdata.any->options->buffer[0].value = 0x02;
printf("Set message priority option: %s\n\r", STATUS_OK_KO(res));
// Create a simple physical mapping:
// - Source 0xF1 (client), target 0x01 (server)
// - Diagnostic message in a fixed normal format
mapping->can_msgtype = PCANTP_CAN_MSGTYPE_EXTENDED;
mapping->netaddrinfo.extension_addr = 0x00;
mapping->netaddrinfo.format = PCANTP_ISOTP_FORMAT_FIXED_NORMAL;
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;
printf("Can tp initialze success\n\r");
return 1;
}
Code: Select all
n_req_t dummy_frame =
{
.n_ai.n_pr = 0x08, /* Network Address Priority */
.n_ai.n_sa = 0xF1, /* Network Source Address */
.n_ai.n_ta = 0x01, /* Network Target Address */
.n_ai.n_ae = 0x00, /* Network Address Extension */
.n_ai.n_tt = N_TA_T_PHY, /* Network Target Address type */
.fr_fmt = CBUS_FR_FRM_STD, /* CANBus Frame format */
.
};
can you elaborate on these configuration.
Regards,
Sandeep C