hardbyte / hardbyte/python-can

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

Ouverte
#1,701 9 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
Python
Étoiles
1.6k
Forks
697
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### 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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.