hardbyte / hardbyte/python-can
CAN-FD Message Truncation Issue When Sending More Than 8 Bytes
- 主要語言
- Python
- 星號
- 1.6k
- 分支
- 697
- PR 合併指標
- 30 天內沒有已合併 PR
描述
### 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.
貢獻指南
研究方向
從 slcan 介面及其傳送路徑開始,使用提供的搭配 CANABLE 裝置的 CAN-FD 範例作為重現案例。比較負載為 8 位元組和超過 8 位元組時的行為,然後驗證超過 8 位元組的 CAN-FD 訊息在傳送和接收時不會被截斷。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- embedded-iot, networking
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100