send several frames in succession
Posted: Wed 22. Mar 2023, 14:21
Hello,
I want to send several times a frame with the same identifier but with different data.
I use UDS_write_2013 function.
I call my function next in this part of the program
the problem is that only the first frame is sent.
I noticed that it happens when the first data is identical for both frames.
if I modify the first data, the two frames are sent.
Thank you
I want to send several times a frame with the same identifier but with different data.
I use UDS_write_2013 function.
Code: Select all
void CAN_send(uds_msgconfig configuration ,unsigned char DataLength,unsigned char * Data)
{
int i=0;
memset(&tx_msg, 0, sizeof(uds_msg));
status = UDS_MsgAlloc_2013(&tx_msg, configuration,DataLength);
if (UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
{
for(i=0;i<DataLength;i++)
{
tx_msg.msg.msgdata.can->data[i]=Data[i];
}
}
else
MessagePopup("Message allocation failed.", "Error");
status = UDS_Write_2013(PCANTP_HANDLE_USBBUS1, &tx_msg);
wait_result = WaitForSingleObject(receive_event,5);
UDS_MsgFree_2013(&tx_msg);
}
I call my function next in this part of the program
Code: Select all
int j=0;
config1.can_id = 0xC4;
config1.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config1.nai.extension_addr = 0x0;
config1.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config1.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config1.nai.target_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config1.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config1.type = PUDS_MSGTYPE_UUDT;
trame[0]=0x88;
trame[1]=0x00;
trame[2]=0x00;
trame[3]=0x00;
trame[4]=0x00;
trame[5]=0x00;
trame[6]=0x00;
trame[7]=0x00;
CAN_send(config1 ,8, trame);
trame[0]=0x88;
trame[1]=0x56;
trame[2]=0x00;
trame[3]=0x00;
trame[4]=0x00;
trame[5]=0x00;
trame[6]=0x00;
trame[7]=0x00;
CAN_send(config1 ,8, trame);
the problem is that only the first frame is sent.
I noticed that it happens when the first data is identical for both frames.
if I modify the first data, the two frames are sent.
Thank you