Page 13 of 16

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Thu 10. Aug 2017, 06:29
by haseel
Dear Michael,

Some more clarifications required.
I am able to read and write the CAN messages through command window using "CANSEND" and "CANDUMP" commands, i can send the message to CANBUS from python program using "Write" function also :) , now only difficulty is reading the message through python using "Read" function. It would be great if you clarify why should i install chardev for this particular requirement.

Thanks in advance.

Rgs,
HASEEL

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Thu 10. Aug 2017, 08:10
by PEAK-Support
because we offer only sample for python for the CharDev driver API PCAN-Basic. If you need/want to use the SocketCAN, please google in the community - this is a community driver and thousends of applications that support SocketCAN are available all over the Internet - we could only support our CharDev Driver, which include the PCAN-Basic API (which also support python)

Here the first 3 entrys when google socketCAN and python...
https://python-can.readthedocs.io/en/la ... ative.html
http://www.bencz.com/hacks/2016/07/10/p ... socketcan/
https://www.python-forum.de/viewtopic.php?t=33795

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Thu 10. Aug 2017, 13:56
by haseel
Thanks Mr. Wilhelm,

As you said, i installed chardev and now read function is working with python.Thank you for your great support. But its working only in first execution (needs reboot for working again) after that it showing error " The receive queue is empty" (value of "object.GetErrorText" ). Any idea?

Rgs,
HASEEL

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Thu 10. Aug 2017, 14:31
by PEAK-Support
Looks like your CAN Controller is in BUS OFF mode (could happened if no secod CAN Contrroller is active on the BUS) You do not need to REBOOT - simply call a INIT again... see here

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Thu 10. Aug 2017, 15:30
by haseel
Thanks Mr. Wilhelm,

I am using INIT function in the beginning of my python script ("objPCAN.Initialize(channel, baud)" ), so whenever i run the script it will initialize again, but same error is populating.

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Thu 10. Aug 2017, 15:35
by PEAK-Support
Looks like you have a HW Problem - please simply check with a Windows System and PCAN-View or with the LINUX Tools we ship, if it works.

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Thu 10. Aug 2017, 15:40
by haseel
Ok, i will check that.

Btw what is actually happening when i do reboot? Can we simulate the same in the script apart from INIT function?

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Thu 10. Aug 2017, 15:43
by PEAK-Support
You Re-Init the CAN-Hardware (like plug off / plug on) but calling CAN_Init() again does also a Hardreset.
You need to find the problem - not a workaround for the problem.

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Wed 16. Aug 2017, 11:32
by haseel
Hi Wilhelm,

I tried with another PEAK USB device, still issue is persist.

Output of below line is
>> print object.Read(channel)
32, that means QRCVEMPTY , CAN bus is empty.
If i do hard reset (USB remove and connect) then it will work for firsttime. The same error will come in second time.

Re: PEAK-Linux Driver on Raspberry Pi

Posted: Wed 16. Aug 2017, 14:30
by PEAK-Support
Looks like your power supply for the RPi is maybe not strong enough - please replace with a supply that could handle more current, or use a Laboratory power supply for testing.