hardbyte / hardbyte/python-can

Ixxat USB-to-CAN v2 | python-can: Close bus, ACK and send_periodic errors

Đang mở
#1,605 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
1.6k
Fork
697
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi,

I'm new with python-can (package version= 4.2.1, running on python3.9.6, under Windows 10) and I wanted to perform a test to send/read CAN message using USB-to-CAN v2 (and SimplyCAN as target).
But I faced few issues using python-can:

**1. Close bus error:**

```
import can
bus = can.interface.Bus(interface='ixxat', channel=0, bitrate=250000, extended=True)
heartbeat = can.Message(arbitration_id=0x11487020, is_extended_id=True, data=[0x01])
bus.send(heartbeat)
bus.shutdown()
```

Above is the code I used to send CAN message. The point is once the code has been performed, it seems to not close properly the CAN bus.
Bellow the error I got:
```
IXXATBus was not properly shut down
Exception ignored in:
```

Is there a way to properly close the CAN bus ? As i can rerun this script even after the error, should I just not taking account this error ?

**2. send_periodic :**
I wanted to send CAN message every seconds using the method "send_periodic" but it raise the bellow exception:
`AttributeError: 'IXXATBus' object has no attribute '_periodic_tasks'`

As in the doc, it's written that for Ixxat devices, the method "send_periodic" is supported, what did I misunderstand for the use of send_periodic method using Ixxat devices ? Bellow the code for the periodic message:
```
import can
bus = can.interface.Bus(interface='ixxat', channel=1, bitrate=250000, extended=True)
heartbeat = can.Message(arbitration_id=0x11487020, is_extended_id=True, data=[0x01])
bus.send_periodic(heartbeat, period=1)
bus.shutdown()
```

**3. NACK error :**

If the target has a problem and couldn't ACK the CAN message, the python-can API print errors logs as bellow:
```
CAN acknowledgment error
CAN message flags bAddFlags/bFlags2 0x00 bflags 0x05
```

And even once the target is reconnected this error message still appears. Is there a way to avoid them ?

Thanks in advance for any help,

Best regards,
Antoine

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.