Using PCAN with linux

869 views
Skip to first unread message

Hans Wurst

unread,
Aug 30, 2017, 4:20:07 PM8/30/17
to python-can
I installed the newest drivers (PCAN_Basic_Linux-4.1.1 and peak-linux-driver-8.4.0) from PEAK. Then I installed python-can with pip. If I set can.rc['interface'] = 'pcan' and can.rc['channel'] = 'pcanusb32' and run for example “send_one()”, I get this error message:

File "./myFile.py", line 27, in send_one bus = can.interface.Bus() File "/usr/local/lib/python2.7/dist-packages/can/interfaces/interface.py", line 72, in __new__ return cls(channel, **kwargs) File "/usr/local/lib/python2.7/dist-packages/can/interfaces/pcan.py", line 80, in __init__ self.m_objPCANBasic = PCANBasic() File "/usr/local/lib/python2.7/dist-packages/can/interfaces/PCANBasic.py", line 46, in __init__ self.__m_dllBasic = windll.LoadLibrary("PCANBasic") NameError: global name 'windll' is not defined


Can anyone tell me please, why i do not get the linux sources with „pip install python-can“?


If i look into the installed file "/usr/local/lib/python2.7/dist-packages/can/interfaces/PCANBasic.py", I can see there is really a missing option to load "libpcanbasic.so". There is only the option for self.__m_dllBasic = windll.LoadLibrary("PCANBasic").




Christian Sandberg

unread,
Aug 30, 2017, 4:53:07 PM8/30/17
to python-can
Try the latest beta:
pip install --pre python-can

Also channel should probably be "PCAN_USBBUS1".

/ Christian

Hans Wurst

unread,
Aug 31, 2017, 8:30:10 AM8/31/17
to python-can

Thank you very much for your response. It is running now. :)

 

I add your suggested channel description “PCAN_USBBUS”, but I cannot see any documentation for that. Google search for “PCAN_USBBUS“ gets only one hit.

 

 

I would like to ask a second question:

I use the send_one()-example with my PCAN. A second one at this physical bus will cat me every message.

 

If I start send_one(), I see no message on the bus.

If I add a second “bus.send(msg)” to the function send_one(), I see two identical messages on the bus.

Otherwise if I only add “bus.rec()”, I also see my desired message on the second one.

 

Closing the bus with “bus.shutdown()” will not solve my problem. I there anything I should care about to prevent buffering on my hardware (or anything else?)?.

 

Reply all
Reply to author
Forward
0 new messages