-
Notifications
You must be signed in to change notification settings - Fork 666
Open
Labels
Description
Describe the bug
Currently I am using a SLCAN adapter to receive and transmit some CAN messages.
The problem I encounter is that there are only a handful(mostly only 3) of messages printed to the console. While the SLCAN adapter works fine when using it in a serial terminal.
Console output of receive_all.py example in console:
Timestamp: 1678957835.071922 ID: 0bb00c02 X Rx DL: 4 2f 0a 00 00
Timestamp: 1678957835.072918 ID: 0bb01c02 X Rx DL: 4 32 0a 00 00
Timestamp: 1678957835.073915 ID: 0bb01c02 X Rx DL: 4 c2 0c 00 00And that's it. It will hang..
To Reproduce
I used the receive_all.py example with the interface initialized like this:
with can.Bus(interface="slcan", channel="COM15@115200", bitrate=500000,
) as bus:Expected behavior
I expected a result similar to manual use in a serial terminal
Manual serial terminal output snippet
V
V0101
S6
O
T1D20F2F2102
T090781008FFFF0F00FFFF0F00
T0BB01C02403040000
T0140800088C72F70B07118010
T00A00C008AC008C72F7070200
T00A01C008AC008C72F7070200
T00200E2280080000000009F44
T00201E22800C3000000003032
T020382221AC
T020782221AC
T0C201F00680119F48CC4F
T00201F0387BCC5B4387F159DA
T0C201F006810804883B4E
T0C201F006820B8A74E34E
T04201F0068DA4C113604F
T04201F0068BA44C03604F
T04201F00697A46DBB614E
T04201F0069DA42A43B04F
T04201F0069EA4637AC04F
T00201F0287BCD5B43780F56DA
T00201F0587BCC5B43780F56DA
T0CF40000403020000
T08E10000403020000
T00200000403020000
T007E0000403020000
T0C200F006800EE0DFDA4F
T0C200F006810843643A4E
T0C200F006820B8837DB4E
T04200F0068877E3C1B04E
T04200F0068977322CB04E
T04200F0068A77E3C1B04E
T04200F0069474AD1DD64D
T04200F006955F94F91DB0
T04200F006965C50A1084D
T04200F0069777E3C1B04E
T00200F01884BC4443780F56DA
T0000000080503FFFE0FFFFE0F
T0000000080502FFFF0F000000
T1D20F2F2102
T090781008FFFF0F00FFFF0F00
T0907810187BCD5B4387F059DA
T08A01D001AC
T08A01D01128
T1A3C82F220200
+ Thousands of messages after this
Additional context
OS and version: Windows 10 22H2
Python version: 3.11.2
python-can version: 4.1.0
python-can interface/s (if applicable): slcan (pyserial 3.5)
Traceback and logs
No Traceback available.Complete receive_all.py example code:
"""
Shows how to receive messages via polling.
"""
import can
from can.bus import BusState
def receive_all():
"""Receives all messages and prints them to the console until Ctrl+C is pressed."""
# this uses the default configuration (for example from environment variables, or a
# config file) see https://python-can.readthedocs.io/en/stable/configuration.html
with can.Bus(interface="slcan", channel="COM15@115200", bitrate=500000,
) as bus:
# set to read-only, only supported on some interfaces
try:
bus.state = BusState.PASSIVE
except NotImplementedError:
pass
try:
while True:
msg = bus.recv(1)
if msg is not None:
print(msg)
except KeyboardInterrupt:
pass # exit normally
if __name__ == "__main__":
receive_all()Reactions are currently unavailable