CANoe settings for intercepting messages sent on Virtual Can Bus with python

68 views Asked by At

Purpose: I want to send data on Virtual Can Bus using Python and then check in CANoe if the request is tracked, but nothing happens. I use a Sample Configuration (ex UDSBasic.cfg) from the CANoe and I do not know if I have to change the Network Hardware or Diagnostic/ISO TP to intercept the message.

What have I tried: I found a lot of code about the use of python-can library, but nothing about how to configure canoe o intercept the messages sent with Python on a virtual bus

import udsoncan
import time
from can.interfaces.vector import VectorBus
from isotp import Address, CanStack
from udsoncan.connections import PythonIsoTpConnection


try:
    # Link Layer (CAN protocol)
    bus = VectorBus(interface='vector', app_name='CANoe', channel=0, bitrate=500000)
    # Network layer addressing scheme
    tp_addr = Address(txid=0x701, rxid=0x601)
    # Network/Transport layer (IsoTP protocol)
    stack = CanStack(bus=bus, address=tp_addr)
    # Interface between Application and Transport layer
    conn = PythonIsoTpConnection(stack)
except Exception as e:
    print(e)

udsoncan.setup_logging()
conn.open()

# send 1 req/sec
for i in range(10):
    # Send test req
    req = b"\x03\x03\x03\x03\x03\x03\x03\x03"
    conn.send(req)
    #resp = conn.wait_frame().hex()
    time.sleep(1)
    
conn.close()

When I run this code, I saw in Vector Hardware Manager, the bus gets some messages while script is running, but in CANoe it doesn't appear anywhere. I think I'm missing some configuration for intercepting the message

Vector Hardware Manager config

CANoe project config (UDSBasic.cfg): default settings

Simmilar topics:

No communication possible with CAN vector Device using python-can

How to debug isotp connection?

0

There are 0 answers