Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set CAN Bus not working with PCANUSB #1

Open
jarvjani opened this issue Feb 18, 2020 · 6 comments
Open

Set CAN Bus not working with PCANUSB #1

jarvjani opened this issue Feb 18, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@jarvjani
Copy link

Hey,
Curf.py: in set_can both self.bus and self.logbus are trying to initialize to same device. This is not possible, and will result as an error when trying to connect logbus.

I removed all the logging and got it working:
-modification in curf.py
def set_can(self, interface, channel, bitrate, db=None, test_name=None):
""" Set the CAN BUS
Keyword arguments:
interface -- can interface (socketcan, vector, ...)
channel -- can channel (can0, vcan0, ...)
bitrate -- can bitrate (125000, 500000, ...)
db -- can database (arxml,dbc,kcd,sym,cdd)
test_name -- Name of test case

    See https://cantools.readthedocs.io/en/latest/#about
    See https://python-can.readthedocs.io/en/master/interfaces.html
    """
    dt_now = dt.datetime.now()
    self.interface = interface
    self.channel = channel
    self.bitrate = bitrate
    self.db_file = db
    self.bus = can.interface.Bus(
        bustype=self.interface, channel=self.channel, bitrate=self.bitrate)
    if db is not None and db != 'None':
        self.db = cantools.database.load_file(db)
        self.db_default_node = self.db.nodes[0].name

    self.is_set = True

-modification to curf.robot

Stop CAN Bus
Stop Bus

-My can.robot test file, located outside CURF folder
*** Settings ***
Resource ./CURF/keywords/curf.robot
Test Setup Set CAN Bus ${INTERFACE} ${CHANNEL} ${BITRATE} ${DB FILE}
Test Teardown Stop CAN Bus
Library DateTime

*** Variables ***
${DB FILE} ./CURF/dbc/example.dbc
${INTERFACE} pcan
${CHANNEL} PCAN_USBBUS1
${BITRATE} 250000
${DEFAULT TIMEOUT} 3000
${DEFAULT NODE} DRIVER

*** Test Cases ***

Send a CAN frame
Send Frame With ID 0x5D3 And DEADBEEF As Data

Send a given signal
Send Signal SENSOR_SONARS_err_count With Value 0

-Proof it works:

kuva

@RomainNaour RomainNaour added the bug Something isn't working label Feb 18, 2020
@RomainNaour
Copy link
Member

RomainNaour commented Feb 18, 2020

Hi @jarvjani,

Thanks for the report, we'll take a look.
Also, feel free to create a PR and provide a patch.

Best regards,
Romain

@chaillm
Copy link

chaillm commented Feb 21, 2020

Hi @jarvjani,

Thanks for your report.
Can you give us some additional infos? Your kernel's version and the traceback generated at runtime would be great.
I've tried to reproduce the bug without success yet.

@jarvjani
Copy link
Author

jarvjani commented Feb 21, 2020

Hey,
I am so sorry i forgot to mention even the most basic technical details.
This happened when using robot framework on windows 10.
This can be easily reproduced by trying to running any tests from testsuite folder on windows machine.

test.zip

Here are the files i am using, and seems to be working on both windows 10 and windows 7.
Tests were done using one of these newer PCAN-USB's (IPEH-002021)

@RomainNaour
Copy link
Member

Hi @jarvjani,

Sorry for the delay, we have never tested on Windows and considered to do it.
I'm glad to this library used even on Windows :)

Can you create a Pull Request on github to contribute your patch?

Best regards,
Romain

@RomainNaour
Copy link
Member

Hi @jarvjani,

Please, create a Pull Request on github for review.

Best regards,
Romain

@KrishnaVinothSingh
Copy link

@jarvjani How to send CAN raw data 11 bit identifier default it was in 29 bit identifier. Where i have to change Normal fixed 11bit identifier for CAN raw data???Can u please help me for above topic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants