hardbyte / hardbyte/python-can

CAN-FD Message Truncation Issue When Sending More Than 8 Bytes

Đang mở
#1,701 9 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
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ả

### Describe the bug
When attempting to send a CAN-FD message with a payload larger than 8 bytes using 'slcan' bustype connected to a CANABLE device, the message appears to be truncated or not sent at all, despite setting `is_fd=True` in the `can.Message` object and `fd=True` in the `can.interface.Bus` initialization. Messages with 8 bytes or less are sent and received correctly.

### To Reproduce
1. Initialize a CAN interface with CAN-FD enabled.
2. Create a CAN-FD message with more than 8 bytes of data.
3. Send the message over the CAN bus.
4. Observe that the message is not sent correctly or is truncated.

### Expected behavior
The CAN-FD message with more than 8 bytes should be sent and received correctly, as per the CAN-FD specifications.

### Additional context

OS and version: Windows 11 Pro 22H2
Python version: 3.11.3
python-can version: 4.3.0
python-can interface/s (if applicable): slcan

### Code Snippet
```python
import can

# Initialize CAN interface with CAN-FD enabled
can_bus = can.interface.Bus(channel='COM16', bustype='slcan', bitrate=500000, fd=True)

# Create a CAN-FD message with more than 8 bytes of data
data = bytes.fromhex("0102000000AAAAAAA000000A") # Example data with more than 8 bytes
message = can.Message(arbitration_id=0x100, is_extended_id=False, data=data, is_fd=True)

# Send the message
try:
can_bus.send(message)
print("Message sent")
except can.CanError as e:
print(f"Error sending CAN message: {e}")
```

**Additional Information:**
Successfully tested sending the same CAN-FD message using the Cangaroo application, where it was received correctly. This suggests that the issue may be specific to the 'python-can' library or its interaction with slcan and the CANABLE device.

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.