hardbyte / python-can

The can package provides controller area network support for Python developers
https://python-can.readthedocs.io
GNU Lesser General Public License v3.0
1.31k stars 604 forks source link

Transmitting/Receiving not work. (Ixxat USB-to-CAN v2) #1841

Closed DotN3tMan closed 3 months ago

DotN3tMan commented 3 months ago

Hi. I'm trying to repeat the code from the documentation in the "Example usage" section. And nothing happens.

My code:

import can

def main():    

    with can.Bus(interface='ixxat', channel=0, bitrate=1000000) as bus:        
        msg = can.Message(arbitration_id=0x420, is_extended_id=True, data=[0x00])        
        bus.send(msg, timeout=0.2)        

        for m in bus: print(f"{m.arbitration_id:X} : {m.data}")        

        bus.shutdown()

    print("Done!")

if __name__ == "__main__":
    main()

Code execution freezes on a line: for m in bus: print(f"{m.arbitration_id:X} : {m.data}")

Can you tell me what I'm doing wrong?

Drivers for Ixxat USB-to-CAN v2 are installed. The durability of the CAN-bus has been checked using the "canAnalyzer3 Mini" (from developer Ixxat) utility.

OS and version: WIN 10 Python version: 3.12 python-can version: 4.4.2 python-can interface/s (if applicable): Ixxat

DotN3tMan commented 3 months ago

In can.Message(arbitration_id=0x420, is_extended_id=True, data=[0x00]) "is_extended_id=True" changed to "is_extended_id=False". It's worked :)