Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not send the can FD message #1798

Closed
ep081106 opened this issue Jun 17, 2024 · 0 comments
Closed

can not send the can FD message #1798

ep081106 opened this issue Jun 17, 2024 · 0 comments
Labels

Comments

@ep081106
Copy link

Describe the bug

when i set
bus = EtasBus(channel=CHANNEL_1, fd=True, bitrate=500000),
but it send the message by CAN:
1000113614

Expected behavior

I want to read the UDS DTC in FD CAN by using ETAS 582.1

Additional context

OS and version: win10
Python version: 3.9 (win32)
python-can version: 4.4.0
python-can interface/s (if applicable): ETAS 582.1

#!/usr/bin/env python

-- coding: utf-8 --

import isotp
import can
import logging
import udsoncan

import snapshot_did_class

from can.interfaces.etas import EtasBus # value can / 582
from udsoncan.connections import PythonIsoTpConnection
from udsoncan.client import Client

status_mask = 0xAF

isotp_params = {
'stmin': 32, # 将请求发送方在连续帧之间等待时间。0 ~ 127ms或100 ~ 900ns,取值范围为0xf1 ~ 0xf9
# Will request the sender to wait 32ms between consecutive frame. 0-127ms or 100-900ns with values from 0xF1-0xF9
'blocksize': 8, # 流控帧单包大小,0为不限制
# Request the sender to send 8 consecutives frames before sending a new flow control message
'wftmax': 0, # 错误帧最大数
# Number of wait frame allowed before triggering an error
'tx_padding': 0xCC, # 空白字节CAN是0x00, FD CANi用0xCC填充
# Will pad all transmitted CAN messages with byte 0x00. None means no padding
'rx_flowcontrol_timeout': 1000, # 流控帧超时时间
# Triggers a timeout if a flow control is awaited for more than 1000 milliseconds
'rx_consecutive_frame_timeout': 1000, # 连续帧超时时间
# Triggers a timeout if a consecutive frame is awaited for more than 1000 milliseconds
}

configs = can.interface.detect_available_configs(interfaces="etas")
CHANNEL_1 = configs[0]['channel'] # CHANNEL_1:ETAS://USB/ES582.1:115287/CAN:1
bus = EtasBus(channel=CHANNEL_1, fd=True, bitrate=500000) # 582的CAN1才行

tp_addr = isotp.Address(isotp.AddressingMode.Normal_11bits, txid=0x78A, rxid=0x7CA) # Network layer addressing scheme
stack = isotp.CanStack(bus=bus, address=tp_addr, params=isotp_params) # Network/Transport layer (IsoTP protocol)
conn = PythonIsoTpConnection(stack) # interface between Application and Transport layer, Define the connection using

configRE300 = snapshot_did_class.config

def read_dtc_and_snapshot():
with Client(conn, request_timeout=100, config=configRE300) as client: # Application layer (UDS protocol)
response = client.get_dtc_by_status_mask(status_mask)

read_dtc_and_snapshot()

@ep081106 ep081106 added the bug label Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant