I want to receive more than 8 bytes data when CAPL program is sending a message from CANOe to ECU. I have implemented ISOTP protocol on ECU for transmitting more than 8 bytes data and it is working fine.
Now my problem is I am trying to call the below CAPL code but I am not able to get the FC frame correctly from ECU. Let assume tester box is my CAPL program. ECU is where I read all the bytes and send response.
on message 0x723
{
checkByte0 = this.byte(0) & 0x30;
//checkByte0 = 0x0F & 0x30;
write("checkbyte value %x",checkByte0 );
if(checkByte0 == 0x30) //FC frame
{
write("checkbyte 30 value %x",checkByte0 );
msg.byte(0) = 0x21;
msg.byte(1) = 0x40;
msg.byte(2) = 0x50;
msg.byte(3) = 0x60;
msg.byte(4) = 0x70;
output(msg);
}
}
//send request write data by identifier 2E F190 parameters
on key 'q'
{
msg.byte(0) = 0x10;
msg.byte(1) = 0x0A;
msg.byte(2) = 0x2E;
msg.byte(3) = 0xF1;
msg.byte(4) = 0x90;
msg.byte(5) = 0x10;
msg.byte(6) = 0x20;
msg.byte(7) = 0x30;
}
Here 0x723 is my request message which is received from CANOe. and 0x72B is my response message which is sent from my ECU. I have attached a screenshot for reference. to show that my read data is received correctly. Where as write is not recived correctly. Output 2E write and read 22 SID and CAPL code
I am also adding code from ECU end just for reference. I am confused do I need to define any functionlaity on ECU receiving side. Or CAPL program is enough to manipulate to receive multiframe ? With the above CAPL code I am not able to receive FC flow control response from ECU.
/* just for underestanding Where
#define ISOTP_SF 0x00 /* single frame */
#define ISOTP_FF 0x10 /* first frame */
#define ISOTP_CF 0x20 /* consecutive frame */
#define ISOTP_FC 0x30 /* flow control */
/*The below line of code is where I receive data from CAN when CANOe sends a message*/
CanData[8] = {0,0,0,0,0,0,0,0}
for(dtcnt=0; dtcnt<RxCAN->DLC; dtcnt++)
{
CanData[dtcnt]= RxCAN->Data[dtcnt];
}
switch((uint16_t)RxCAN->StdId)
{
case TESTER_TO_EDS: //CAN 0x723 Diagnostic
{
/*Request message from CAN to Diagnostic*/
dgiIsoTp.IsoTpFrameTypeRcv = (0xF0 & CanData[0]);
/*If Isotp Single frame == 0 then read 8 byte data */
if (dgiIsoTp.IsoTpFrameTypeRcv == ISOTP_SF)
{
ReadCanMsg_ISOTP(CanData, TESTER_TO_EDS);
}
else if(dgiIsoTp.IsoTpFrameTypeRcv == ISOTP_FF)
{
ReadCanMsg_ISOTP(CanData, TESTER_TO_EDS);
}
break;
}
}
/*The below lines of code where I manipulate my received message and send response based on the request message*/
void ReadCanMsg_ISOTP(uint8_t CanData[], uint16_t CanIdReq)
{
uint8_t i; /*---- valid data bytes-----*/
dgiIsoTp.IsoTpFrameType = 0xFF;
dgiIsoTp.IsoTpLengthCtn = 0x00;
dgiIsoTp.IsoTpBlockCtn = 0x00;
dgiIsoTp.IsoTpFrameNum = 0x00;
dgiIsoTp.TpCanID = CanIdReq; /*response CAN ID must receive here */
dgiIsoTp.IsoTpLen = (uint8_t) CanData[0]; /*Diagnostic Data parameters message are received here*/
for (i = 0; i <= dgiIsoTp.IsoTpLen; i++)
{
/*Msgarr[25] buffer is defined if the data is > than 8 Msgarr[] must be updated */
dgiIsoTp.Msgarr[i] = CanData[i];
}
/*-- Check message length and frame type-- #define CAN_SIZE = 8*/
if (dgiIsoTp.IsoTpLen > (CAN_SIZE - 1))
{
dgiIsoTp.IsoTpFrameType = ISOTP_FF; /* must be == 0x10*/
/*Here below function isoTpSend() will be called and update the multiple frames */
isoTpSend();
}
else
{
dgiIsoTp.IsoTpFrameType = ISOTP_SF; /*must be == 0x00*/
isoTpSend();
}
}
I have added above piece of code to get understand about my problem. From CANOe I trigger the key button 'q'.
Here Length = 0x0A which is 10 bytes, SID 2E, DID F190, Data[10 20 30 40 50 60 70]
I receive a message 10 0A 2E F1 90 10 20 30
and the next FC frame is not sent from ECU to CANOe. Where I am not able to receive CF 2nd Frame bytes 21 40 50 60 70 00 00 00
from CANOe. I want to know how to implement this ?. Do I need to add code in my ECU applicaiton side if so any suggestion how to implement.
So that I could receive request with more than 8 bytes. Where response will be 03 6E F1 90 00 00 00 00
.
I don't have CDD file and license to candela. Currently, for testing purpose I have to follow manual method where I could implement a CAPL code to send request to ECU using SID 2E Please could someone correct me with the logic. I have also attached an image of the current output.
I am adding solution to my question. I am positing below code just for reference if someone are new to capl. The below solution works to receive frame more than 8 bytes using WriteDatabyIdentifier SID 2E for UDS diagnostics. I also thankful to @M.spiller who supported me while making me to understand the Frame Control client and interface to Vector CANOe and CAPL script. I am also adding if someone want to send more than 16 bytes data follows below.
variables
{
byte checkByte0;
message 0x723 msg = { dlc=8};
message 0x723 msg1 = { dlc=8};
}
on message 0x723
{
checkByte0 = this.byte(0) & 0x30;
//checkByte0 = 0x0F & 0x30;
write("checkbyte value %x",checkByte0 );
if(checkByte0 == 0x30) //FC frame
{
write("checkbyte 30 value %x",checkByte0 );
msg.byte(0) = 0x21; //CF
msg.byte(1) = 0xc8;
msg.byte(2) = 0x9d; //data
msg.byte(3) = 0x02;
msg.byte(4) = 0x8d;
msg.byte(5) = 0xfa;
msg.byte(6) = 0x16;
msg.byte(7) = 0x8a;
msg1.byte(0) = 0x22; //CF
msg1.byte(1) = 0x85;
msg1.byte(2) = 0x93; //data
msg1.byte(3) = 0x3a;
msg1.byte(4) = 0xef;
msg1.byte(5) = 0xdd;
msg1.byte(6) = 0x00;
msg1.byte(7) = 0x00;
output(msg);
output(msg1);
}
}
//send request write data by identifier 2E F190 parameters
on key 'q'
{
msg.byte(0) = 0x10;
msg.byte(1) = 0x0A;
msg.byte(2) = 0x2E;
msg.byte(3) = 0xF1;
msg.byte(4) = 0x90;
msg.byte(5) = 0x10;
msg.byte(6) = 0x20;
msg.byte(7) = 0x30;
}