hardbyte / hardbyte/python-can

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

Aberta
#1,701 9 comentários 0 reações 0 responsáveis Ver no GitHub
bug
Linguagem predominante
Python
Estrelas
1.6k
Forks
697
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece pela interface slcan e pelo seu caminho de envio, usando o exemplo de CAN-FD fornecido com um dispositivo CANABLE como caso de reprodução. Compare o comportamento para payloads de 8 bytes e de mais de 8 bytes e, em seguida, verifique se as mensagens CAN-FD com mais de 8 bytes são enviadas e recebidas sem truncamento.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
embedded-iot, networking
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.