-
Notifications
You must be signed in to change notification settings - Fork 585
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
Enable echo frames in PCAN driver if receive_own_messages is set #1723
Enable echo frames in PCAN driver if receive_own_messages is set #1723
Conversation
Run |
This looks nice. I can test it next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import can
def main():
bus1 = can.Bus(
interface="pcan", channel="PCAN_USBBUS1", bitrate=500000, receive_own_messages=True
)
bus2 = can.Bus(
interface="pcan", channel="PCAN_USBBUS2", bitrate=500000, receive_own_messages=False
)
msg1 = can.Message(arbitration_id=0x123, is_fd=False, data=b'hello')
msg2 = can.Message(arbitration_id=0x123, is_fd=False, data=b'world')
bus1.send(msg1)
print(bus1.recv(0.1))
print(bus1.recv(0.1))
print(bus2.recv(0.1))
print(bus2.recv(0.1))
bus2.send(msg2)
print(bus1.recv(0.1))
print(bus1.recv(0.1))
print(bus2.recv(0.1))
print(bus2.recv(0.1))
if __name__ == "__main__":
main()
I did a back-to-back test with two PCAN interfaces, and the output I got was the following:
Timestamp: 1705482812.765127 ID: 00000123 X Rx DL: 5 68 65 6c 6c 6f 'hello'
None
Timestamp: 1705482812.765166 ID: 00000123 X Rx DL: 5 68 65 6c 6c 6f 'hello'
None
Timestamp: 1705482812.970332 ID: 00000123 X Rx DL: 5 77 6f 72 6c 64 'world'
None
None
None
So, it looks like it's working as intended.
Is it possible to detect the message direction to set the |
I will check. |
Works :) |
Same here:
|
Thank you for your efforts and keep up the great work :) |
This allows the reception of messages sent over the interface. Before, setting the parameter receive_own_messages did not have any effect for the PCAN interface.
Tested with PEAK PCAN-USB FD dongle, Firmware version 3.2.0