Unable to send CAN FD frame using python-can (PCAN-USB Pro FD)
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 32/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- embedded-iot, networking
Piste de recherche
Commencez par la configuration de pcan bus dans can.interface.Bus et la construction de can.Message présentée dans le rapport, en vous concentrant sur la configuration FD et du bitrate pour PCAN_USBBUS2. Reproduisez les deux exemples avec python-can 4.50.0 et comparez le type de trame obtenu ainsi que le comportement de CanError dans PCAN-View. Le travail est terminé lorsque la configuration documentée envoie la trame CAN FD demandée ou signale clairement le paramètre invalide.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Hi everyone,
I’m currently working on a test bench that communicates over CAN and CAN FD using a PCAN-USB Pro FD interface.
Sending standard CAN messages like 0x214 works perfectly from both Python and PCAN-View 👍
But I can't seem to send a CAN FD frame properly through Python. My goal is to send a frame with ID 0x1E38400C, data length = 2, and data = [0xEB, 0x10], using CAN FD (with is_fd=True, bitrate_switch=True, is_extended_id=True) 👎
I can send this same frame via PCAN-View successfully when enabling FD mode. So I know the hardware and channel config are okay.
I’ve tried a few code samples including the official ones from the python-can documentation, but I either get:
-
No error, but the frame is sent as standard CAN (not FD), or
-
can.CanError: A parameter contains an invalid value
Configuration:
- Interface: pcan
- Channel: PCAN_USBBUS2
- Bitrate: 500000
- Data bitrate: 2000000 (Can FD = 2Mb/s) ?
My setup:
OS and version: window11
PCAN-USB Pro FD
Python version: 3.12.9
python-can version: 4.50.0
VScode : 1.100.2
notepad++: 8.8.1
my functions
def periodic_message_can2(can_id=0x1E38400C, interface='pcan', channel='PCAN_USBBUS2'):
try:
bus = can.interface.Bus(interface=interface, channel=channel, fd=True, bitrate=500000, data_bitrate=2000000)
can_data_on = [0xEB, 0x10]
msg = can.Message(
arbitration_id=can_id,
data=can_data_on,
is_extended_id=True,
is_fd=True,
bitrate_switch=True,
dlc=2
)
bus.send_periodic(msg, 1.0)
print(" Message FD envoyé en périodique.")
except can.CanError as e:
print(f" Erreur CAN : {e}")
except Exception as e:
print(f" Erreur générale : {e}")
#OUTPUT for this one : can.CanError: A parameter contains an invalid value
############################################################
#Second function
def periodic_message_can(can_id=0x1E38400C, interface='pcan', channel='PCAN_USBBUS2'):
try:
bus = can.interface.Bus(interface=interface, channel=channel, fd=True)
can_data_on = [0xEB, 0x10]
msg = can.Message(arbitration_id=can_id, data=can_data_on, is_extended_id=True, is_fd=True, dlc=2, is_rx=False)
bus.send_periodic(msg, 1)
except can.CanError as e:
print(f"Erreur CAN : {e}")
except Exception as e:
print(f"Erreur générale : {e}")
#The function executes without any errors, but it looks like my frame is not sent as CAN FD...
When I check this frame in PCAN-View, the “Type” field is empty, which usually indicates it's a standard CAN frame and not an FD one. So even though I set is_fd=True in the code, it seems like it's not actually taking effect.
- Langage dominant
- Python
- Étoiles
- 1.6k
- Forks
- 697
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de hardbyte/python-can
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
hardbyte/python-can#2103 ·
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
hardbyte/python-can#2077 · 1 commentaire · 1 réaction ·
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 68/100
hardbyte/python-can#1922 · 1 réaction ·
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
hardbyte/python-can#2102 ·
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
hardbyte/python-can#2092 ·
Toutes les issues de hardbyte/python-can
Issues similaires
-
bug priority:low
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
CyberAgent/psd2svg#436 ·
-
area/install-update comp/cli comp/desktop P3 sweeper:risk-compatibility type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
NousResearch/hermes-agent#122386 · 1 commentaire ·
-
ai-generated
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
vllm-project/production-stack#1105 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100