Page 1 of 1

PCAN-USB FD API InitializeFD faild

Posted: Wed 15. May 2019, 15:44
by yuriy
Hello,

I have PCAN-USB FD device. I try run simple example from documentation.

Code: Select all

from PCANBasic import *

# Defines a FD Bit rate string with nominal and data Bit rate set to 1 MB
#
bitrate = "f_clock_mhz=24, nom_brp=1, nom_tseg1=17, nom_tseg2=6, nom_sjw=1, data_brp=1, data_tseg1=16, data_tseg2=7, data_sjw=1"

# The FD capable Channel (PCAN-USB Pro FD) is initialized
#
objPCAN = PCANBasic()
result = objPCAN.InitializeFD(PCAN_USBBUS1, bitrate)
if result != PCAN_ERROR_OK:
    # An error occurred, get a text describing the error and show it
    #
    result = objPCAN.GetErrorText(result)
    print result[1]
else:
    print "PCAN-USB Pro FD (Ch-1) was initialized"

# All initialized channels are released
#
objPCAN.Uninitialize(PCAN_NONEBUS)

but i got error

Code: Select all

A PCAN Channel has not been initialized yet or the initialization process has failed
My log from pcaninfo

Code: Select all

PCAN driver version: 8.8.0

  * pcanusbfd32: (/sys/class/pcan/pcanusbfd32)
        - file: /dev/pcan32
        - dev: "240:32"
        - dev_name: "/dev/pcan32"
        - minor: 32
        - base: 0
        - irq: 0
        -----------------
        - adapter_name: "PCAN-USB FD"
        - adapter_number: 0
        - adapter_version: "3.2.0"
        - type: "usbfd"
        - hwtype: 18
        - devid: 0x00
        - ctrlr_number: 0
        - mass_storage_mode: 0
        -----------------
        - clock: 8 MHz
        - nom_bitrate: 1 MBit/s
        - btr0btr1: 0x14
        - data_bitrate: 2 MBit/s
        - init_flags: 0
        - clk_drift: 131072
        - ts_fixed: 0
        -----------------
        - nom_brp: 1
        - nom_sample_point: 7.50%
        - nom_sjw: 1
        - nom_tseg1: 59
        - nom_tseg2: 20
        - nom_tq: 12
        - data_brp: 1
        - data_sample_point: 7.50%
        - data_sjw: 1
        - data_tseg1: 29
        - data_tseg2: 10
        - data_tq: 12
        -----------------
        - bus_state: OK (1)
        - bus_load: 0%
        - rx_error_counter: 0
        - tx_error_counter: 0
        - tx_fifo_ratio: 0%
        -----------------
        - irqs: 0
        - status: 0
        - errors: 0
        - read: 0
        - write: 0
        -----------------
        - TPCANHandle: "PCAN_USBBUS1" (0x051)
        -----------------

Help me.

Re: PCAN-USB FD API InitializeFD faild

Posted: Wed 15. May 2019, 16:27
by yuriy
Hi,


I solved the problem. I had interface configuration with

Code: Select all

allow-hotplug can0
iface can0 can static
bitrate 1000000
if bitrate sets, InitializeFD will fail.

Re: PCAN-USB FD API InitializeFD faild

Posted: Mon 20. May 2019, 14:11
by Bourass
Hi,

how did you solve the issue.
i have the same issue sometimes could you please explain more.