CAN-FD with Vector

693 views
Skip to first unread message

Music

unread,
Aug 26, 2019, 3:10:23 AM8/26/19
to python-can
I am trying to send a CAN-FD frame using Vector Device but have some trouble figuring it out.
I am able to send it over Classic CAN with different BaudRates.

here's what I tried for CAN-FD:
# create a bus instance
# many other interfaces are supported as well (see below)
interface = 'vector'
channel = 0
baud = 1000 * 33.333
# baud = 1000 * 25
data_baud = 1000 * 500

bus = can.Bus(
    interface=interface, 
    channel=channel, 
    bitrate=baud, 
    data_bitrate=data_baud, 
    receive_own_messages=True,
    fd=True
)

# send a message
message = can.Message(arbitration_id=0x555, is_extended_id=False,dlc=8,is_fd=True,bitrate_switch=True,
                      data=[0x55, 0x55, 0xB9, 0x07, 0x10, 0x00, 0x54, 0x05])
bus.send(message, timeout=0.2)

the above code generates an error:
VectorError Traceback (most recent call last) <ipython-input-28-f846ed15bb5a> in <module> 2 message = can.Message(arbitration_id=0x555, is_extended_id=False,dlc=8,is_fd=True,bitrate_switch=True, 3 data=[0x55, 0x55, 0xB9, 0x07, 0x10, 0x00, 0x54, 0x05]) ----> 4 bus.send(message, timeout=0.2) 5 print(message) 6 msg = bus.recv() ~\jupyter_notebooks\python-can-develop\can\interfaces\vector\canlib.py in send(self, msg, timeout) 438 XLcanTxEvent.tagData.canMsg.data[idx] = value 439 vxlapi.xlCanTransmitEx( --> 440 self.port_handle, mask, message_count, MsgCntSent, XLcanTxEvent 441 ) 442 ~\jupyter_notebooks\python-can-develop\can\interfaces\vector\vxlapi.py in check_status(result, function, arguments) 274 def check_status(result, function, arguments): 275 if result > 0: --> 276 raise VectorError(result, xlGetErrorString(result).decode(), function.__name__) 277 return result 278 VectorError: xlCanTransmitEx failed (XL_ERR_INVALID_FDFLAG_MODE20)


If I remove the flag : fd=True, from the same code
I don't get any error and message frame is :
Timestamp: 0.000000 ID: 0555 S F BS DLC: 8 55 55 b9 07 10 00 54 05

I need help with configuring the CAN-FD Message and BUS

Christian Sandberg

unread,
Sep 1, 2019, 7:09:41 AM9/1/19
to python-can
Do you have some other application connected to the same channel? Has that been configured for CAN-FD? One possible reason that the channel has not been initialized with CAN-FD support is if python-can does not get init access.

Also, the bitrates seem very slow for CAN-FD. Usually the data bitrate is >= 1 Mbit/s for example. Not sure how the driver handles this. And it also seems that Vector requires bit timing parameters to be set explicitly for CAN-FD. See the documentation for xlCanFdSetConfiguration in the vxlapi docs and python-can docs.

SERIDJ Mohammed

unread,
Sep 1, 2019, 8:16:38 AM9/1/19
to Christian Sandberg, python-can

hi

  Thank you for your message, but i am really busy and won't be able to work for you. Sorry


  


--
You received this message because you are subscribed to the Google Groups "python-can" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-can+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-can/cddd4e52-9914-48ae-8b50-beadd1080bf3%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages