-1

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.

  • What I see: CANoe sends a first frame, but the ECU does not send a flow control frame, and therefore CANoe is not sending the consecutive frame(s). Why this is the case is buried somewhere deep in your ECU code, from which you only show a subset. The issue does not seem to be within the CAPL code, but your ECU implementation. – MSpiller Oct 11 '22 at 12:30
  • If that is the place where you can be sure that you have just received a first frame, then yes, this is the place where you should send the flow control frame back to the tester. – MSpiller Oct 11 '22 at 13:14
  • @M.Spiller, thank you for your response. Your understanding is right. I am only confused when I am receiving the bytes from CANOe. In the above code can you tell me if I define the flow control functionality under this condition ? : else if(dgiIsoTp.IsoTpFrameTypeRcv == ISOTP_FF) { ReadCanMsg_ISOTP(CanData, TESTER_TO_EDS); ?? } . Please could you share an example ? in CAPL on message 0x723{ checkbyte = 30 } how this byte is read from ECU. Do I need to send a response message then my response ll be 0x72B 30 00 00 00 00 00 00 00. ? – Mahesh Reddy Oct 11 '22 at 13:17
  • @M.Spiller thank you. Now I understood that I will receive first frame store the data in an array and send the control frame to get the reset of the bytes and then I can manipulate as per my requirements. Then it should work. I will try now, I am assuming all the control can be handle done in CAPL while requesting the message. – Mahesh Reddy Oct 11 '22 at 13:20
  • You should read the ISO TP specification (or at least wikipedia). With the flow control frame, the (in your case) ECU can specify, how many consecutive frames, the tester should send before waiting again for a flow control frame. Also it can be specified "how fast" the tester should send the frames. The most simple case is just sending `30 00 00`. Which means, _send me all remaining data as fast as possible_. – MSpiller Oct 11 '22 at 13:24
  • @M.Spiller, thank you for your time and effort without your comments I couldn't able to fix the above issue. Now my implemention works perfectly. Now I am able to send ISOTP frame and receive ISOTP frames via CANOe. Please, could you suggest me CAPL examples where I could send 3 or 4 CF frames from CANOe Rx. example with 8 bytes of data using "on message 0x723" ? – Mahesh Reddy Oct 17 '22 at 09:41
  • CANoe comes with several sample configurations. You could try "OSEK TP Multichannel", where data is sent using ISO TP. Or "UDS Diagnostics Basic Example". – MSpiller Oct 20 '22 at 07:24

1 Answers1

0

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;
 }