1

I am a beginner in CAPL script. I am writing a script to send a 8 byte message with a frame id (PID). When i run the script in canoe, ECU does not give a response.Every thing in the setup and database is correct. There is a problem in script. Below is the script.

/*@!Encoding:1252*/
variables
{
   linmessage 0x11  Request;
   linmessage 0x25  Response;
   linmessage 0x01  Initiate_wake_up;

   byte WakeUpFrame = 0x3E;
   byte Request_Header = 0x11;
   byte Response_Header = 0x25;
}



void Util_SendHeader(byte frameID)
{
   Request.MsgChannel = 1;
   Request.ID = frameID;
   Request.RTR=1;  
   output(Request); 
}



void Wake_Up_Frame()
{
   Util_SendHeader (WakeUpFrame);
   Request.byte(0)=0x00;
   Request.byte(1)=0x00;
   Request.byte(2)=0x00;
   Request.byte(3)=0x00;
   Request.byte(4)=0x00;
   Request.byte(5)=0x00;
   Request.byte(6)=0x00;
   Request.byte(7)=0x00;
   Request.rtr=0;
   output(Request);  
}

on key 'q'
{
   Wake_Up_Frame();
   Request.byte(0) = 0x00;
   Request.byte(1) = 0x0A;
   Request.byte(2) = 0x00;
   Request.byte(3) = 0x00;
   Request.byte(4) = 0x00;
   Request.byte(5) = 0x00;
   Request.byte(6) = 0x00;
   Request.byte(7) = 0x00;
   Util_SendHeader (Request_Header);
   Request.rtr=0;
   output(Request);
   Util_SendHeader (Response_Header);
}

Please help me.

Prakash
  • 27
  • 1
  • 9

1 Answers1

2

To send a LIN message, two output() calls are required: 1-st with .rtr=0 and second with .rtr=1.

The first one schedules message data for transmission. The second one triggers the transmission.

If, instead of second output(), some external master sends the message header on the LIN bus, and the header ID matches the ID of scheduled message, the tool will transmit the message (acting as a slave).

To receive a message from slave, only the second output() is required. It will transmit the message header on LIN bus. Any slave that has a matching message ready (same ID) will transmit the message data.

Daemon Painter
  • 3,208
  • 3
  • 29
  • 44