We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I want to change txid before send a daigrequest, but i did not see the function interface in isotp. Is there any good way to achieve this requirement?
isotp
import can import isotp import binascii from udsoncan.connections import PythonIsoTpConnection iso_tp_params = { "stmin": 0, "blocksize": 0, "wftmax": 0, "tx_data_length": 8, "tx_data_min_length": None, "tx_padding": 0xAA, "rx_flowcontrol_timeout": 1000, "rx_consecutive_frame_timeout": 1000, "max_frame_size": 4095, "can_fd": False, "bitrate_switch": True, # "rate_limit_window_size": 0.1, } def set_bus(): return can.interface.Bus( interface="vector", channel='9', app_name="Python Can", bitrate=500000, fd=False, data_bitrate=2000000, tseg1_abr=63, tseg2_abr=16, sjw_abr=15, tseg1_dbr=15, tseg2_dbr=4, sjw_dbr=2, receive_own_messages=True) can_bus = set_bus() tp_address = isotp.Address( addressing_mode=isotp.AddressingMode.Normal_11bits, txid=0x701, rxid=0x709, ) tp_stack = isotp.NotifierBasedCanStack( bus=can_bus, notifier=can.Notifier(can_bus, [can.Printer()]), address=tp_address, params=iso_tp_params ) conn_tp = PythonIsoTpConnection(tp_stack) if not conn_tp.is_open(): conn_tp.open() conn_tp.send(binascii.a2b_hex('1001')) # send diag request with tx_id = 0x701 # how to change tx_id = 0x7df ,but do not make a new 'conn_tp' conn_tp.send(binascii.a2b_hex('1001')) # send diag request with tx_id = 0x7df
The text was updated successfully, but these errors were encountered:
you can use the set_address() method on the stack object
set_address()
https://can-isotp.readthedocs.io/en/latest/isotp/implementation.html#isotp.TransportLayer.set_address
Sorry, something went wrong.
Carefull, set_address is not thread safe. you may want to take extra care when changing it.
if you only change the transmit part, I expect no issues. If you change the receiving address, you may mix can frames from different ECU
The safest way would be to stop, change the address, then start again
If that is not enough, we can consider adding thread safety around this method.
No branches or pull requests
Hi,
I want to change txid before send a daigrequest, but i did not see the function interface in
isotp
. Is there any good way to achieve this requirement?The text was updated successfully, but these errors were encountered: