3

I am trying to send a message on the CAN bus in CANoe with a .NET test module.

This is the code that I used

using Vector.Scripting.UI;
using Vector.CANoe.TFS;
using Vector.CANoe.VTS;
using NetworkDB;


public class main : TestModule
{
    public override void Main()
    {
        byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
        CANFrame msg = new CANFrame(0x01, 4); // ID=0x500, DLC=4
        msg.SetRawData(data);
        msg.Channel = 1;
        var a =  msg.Send();

        Output.WriteLine(Convert.ToString(a));
    }
 
}

And this is the message I get in the write window of CANoe.

System Node TEST (CAPL): [TEST] Output to bus system CAN channel 1 not allowed!

Shyam
  • 649
  • 1
  • 5
  • 20
  • In the code you create a CAN frame. In the text you say, you want to send a LIN message. What exactly to you want to do? – MSpiller Jan 18 '21 at 17:12
  • Also, your code shows .NET code, the error message and the tags say CAPL. What are you trying to do? – MSpiller Jan 19 '21 at 10:58
  • You are right, the questions is a bit unclear. What I am traing to do is to make a configuration in CANoe that supports LIN and also CAN(2 buses connected to the can case), and send CAN messages with a .NET test module.I don't know why the CAPL appears in the output message,I suppose is because the .NET is translated to CAPL code but I am not sure... – Călin Corcoțoi Jan 24 '21 at 21:26
  • Could you share a screenshot of your CANoe configuration? Esp. the configuration of your .NET testmodule and it's testconfiguration. – MSpiller Jan 25 '21 at 08:41
  • Unfortunately I can't make a screenshot because of the company rules.But is the standard solution made by CANoe when a new .Net test module is made. I found why the error was. In the configuration needs to be two networks one for LIN and one for CAN. In order to make a new networks need to do the folowing steps: 1) go to simulation setup. 2)right click on the network icon and select 'Add...' and select what protocol you want to use. Thanks for the help,I really respect the willing to help me out with this problem. – Călin Corcoțoi Jan 25 '21 at 12:54

1 Answers1

1

Go to the configuration of the .NET Test Module. Under the tab "Buses", check if the bus on which you want to send the CAN Frame is present under "Assigned Buses".

I hope this is the only configuration which you have missed.

Shyam
  • 649
  • 1
  • 5
  • 20