1

In my current setup, I have a LIN Master and a LIN slave. The schedule table is unconditional, and never re-negotiated:

  • Master Frame

  • Slave Frame

  • Slave Frame

I'm using physical bus and simulated Master (physical Slave). My goal is to apply censorship to certain LIN frames, in real-time.

For instance, I know that a request from Master (maybe single or multi-frame) will trigger a specific Slave response. I would like to catch this response, say in a CAPL script, perform checks on the content and apply selective censorship to it, so that the frame received by the Master doesn't say what the Slave transmitted in the first place. When no Master request is sent, both Master and Slave keep sending empty frames to fulfill the schedule table.

I can easily "catch" the frame with a non-transparent CAPL, but I'm unsure of how I would re-transmit it.

According to the output() keyword documentation:

To reconfigure response data of LIN frame. In that case RTR selector has to be set to 0. The LIN hardware responds to the next request of the specified frame with the newly configured data.

I don't want to add a delay of one message in transmission. And given the following constraints, I have no idea of how to do this, or if it is even possible with the CAPL API in CANoe:

  • I cannot foresee when a Master Request is broadcasted;
  • I know that Slave will reply immediately with acknowledge;
  • After a time that I cannot foresee, Slave will send additional data that I want to censor;
  • The Slave reply has to be modified in place and re-transmitted;
  • The original Slave reply must never reach the Master.

Rejected pseudo-code:

on linFrame 0x01    // <-- slave frame
{
    if( payload I'm looking for )
    {
        // edit payload content
    }
    output(this)
}
Daemon Painter
  • 3,208
  • 3
  • 29
  • 44

1 Answers1

1

Especially since

The original Slave reply must never reach the Master.

you have to physically disconnect Master and Slave and put CANoe inbetween

You would need a network interface with (at least) two LIN channels - one connected to the master and one connected to the slave - and need CANoe be setup as a gateway between these two channels. I.e. acting as a Master towards the Slave and acting as a Slave towards the Master.

In your gateway implementation you can then do whatever you want with the messages exchanged between master and slave.

Doable but not that much fun.

MSpiller
  • 3,500
  • 2
  • 12
  • 24
  • I feared feedback like this one. I still have hope in some parts of the CANoe CAPL API, though. For instance, I'm evaluating the `linUpdateResponse(linFrame frame)`, under the premises that I must be able to predict when I need to output frame _x_ on frame _x-1_ to correctly set the reply up. In the end, as you say, "Doable but not that much fun" might imply that Vector foresaw the use case and already provided a function for that. – Daemon Painter Dec 09 '19 at 15:13
  • I think linUpdateResponse is solely for simulated nodes, but best of luck. You can check the demo configuration coming with CANoe. I think there is an example for a CAN-LIN-Gateway. Maybe that one can be adapted. – MSpiller Dec 09 '19 at 17:50