Unable to send CAN FD frame using python-can (PCAN-USB Pro FD)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 32/100
- Issue-Typ
- Bug
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- python
- Bereich
- embedded-iot, networking
Rechercherichtung
Beginne mit dem pcan bus setup in can.interface.Bus und der im Bericht gezeigten can.Message-Konstruktion und konzentriere dich auf die FD- und Bitratenkonfiguration für PCAN_USBBUS2. Reproduziere die beiden Beispiele mit python-can 4.50.0 und vergleiche den resultierenden Frame-Typ sowie das CanError-Verhalten in PCAN-View. Als abgeschlossen gilt, wenn die dokumentierte Konfiguration entweder den angeforderten CAN-FD-Frame sendet oder den ungültigen Parameter eindeutig meldet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 1.6k
- Forks
- 697
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus hardbyte/python-can
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
hardbyte/python-can#2103 ·
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
hardbyte/python-can#2077 · 1 Kommentar · 1 Reaktion ·
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
hardbyte/python-can#1922 · 1 Reaktion ·
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
hardbyte/python-can#2102 ·
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
hardbyte/python-can#2092 ·
Alle Issues in hardbyte/python-can
Ähnliche Issues
-
area: harness bug status: needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Human-Agent-Society/reef#625 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 80/100
learningequality/kolibri#15351 · 2 Kommentare ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Name consistency Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
eellak/triplestore#65 · 1 Kommentar ·