Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Unable to send CAN FD frame using python-can (PCAN-USB Pro FD)

オープン
#1,943 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
32/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python

調査の方向性

レポートに示されている can.interface.Bus での pcan bus セットアップと can.Message の構築から始め、PCAN_USBBUS2 の FD および bitrate 設定に焦点を当てます。python-can 4.50.0 で 2 つの例を再現し、結果として得られるフレームタイプと PCAN-View での CanError の動作を比較します。完了条件は、文書化された設定によって要求された CAN FD フレームが送信されるか、無効なパラメーターが明確に報告されることです。

索引モデルが issue の本文から書いたものです。

説明

bug

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.

主要言語
Python
スター
1.6k
フォーク
697
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hardbyte/python-can のほかの issue

hardbyte/python-can の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。