-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sending segmented UDS messages over CAN using python-can package.
- Loading branch information
1 parent
9469cad
commit c4cd72d
Showing
12 changed files
with
1,866 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
examples/can/python-can/kvaser/python_can_timing_issue_2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""UDS Issue: https://github.com/mdabrowski1990/uds/issues/228""" | ||
|
||
from time import time | ||
|
||
from can import BufferedReader, Bus, Message, Notifier | ||
|
||
if __name__ == "__main__": | ||
kvaser_interface_1 = Bus(interface="kvaser", channel=0, fd=True, receive_own_messages=True) | ||
kvaser_interface_2 = Bus(interface="kvaser", channel=1, fd=True, receive_own_messages=True) # connected with bus 1 | ||
|
||
buffered_reader = BufferedReader() | ||
notifier = Notifier(bus=kvaser_interface_1, listeners=[buffered_reader]) | ||
|
||
message = Message(data=[0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0], arbitration_id=0x100) | ||
|
||
for _ in range(10): | ||
timestamp_before_send = time() | ||
kvaser_interface_1.send(message) | ||
sent_message = buffered_reader.get_message(timeout=1) | ||
timestamp_after_send = time() | ||
|
||
print(f"-----------------------------------------------\n" | ||
f"Result:\n" | ||
f"Timestamp before send: {timestamp_before_send}\n" | ||
f"Message timestamp: {sent_message.timestamp}\n" | ||
f"Current timestamp: {timestamp_after_send}\n" | ||
f"Message timestamp - Timestamp before send: {sent_message.timestamp - timestamp_before_send} (expected > 0)\n" | ||
f"Current timestamp - Message timestamp: {timestamp_after_send - sent_message.timestamp} (expected > 0)\n" | ||
f"Timestamp before send <= Message timestamp <= Current timestamp: {timestamp_before_send <= sent_message.timestamp <= timestamp_after_send} (expected `True`)") | ||
|
||
kvaser_interface_1.shutdown() | ||
kvaser_interface_2.shutdown() |
420 changes: 230 additions & 190 deletions
420
tests/software_tests/segmentation/test_can_segmenter.py
Large diffs are not rendered by default.
Oops, something went wrong.
759 changes: 720 additions & 39 deletions
759
tests/software_tests/transport_interface/test_can_transport_interface.py
Large diffs are not rendered by default.
Oops, something went wrong.
547 changes: 470 additions & 77 deletions
547
tests/system_tests/transport_interface/can_transport_interface/test_python_can.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.