I am attempting to create a program that can read DTC codes from CAN-Bus devices connected to a Raspberry Pi via a USB to Serial connection. I am testing with a NeoVi Fire that I have hooked up, and currently I am able to send and read serial signals to the device to control car seat heating and cooling units I have attached to it via said serial port.
Now I need to expand what I have into requesting codes from the CAN unit so I am seeing if Python-CAN can do what I need it to (since the rest of my program is all written in Python).
I also went and installed the PyNeoVi library since I am using the NeoVi unit, and I am running into a problem while attempting to use one of the test files with the PyNeoVi repository. This is the code for the test file:
import neovi.neodevice as neodevice
import neovi.ecu as ecu
import neovi.spec as spec
import neovi.neovi as neovi
import json
neodevice.init_api()
dev = neodevice.find_devices(neovi.NEODEVICE_FIRE)[0]
dev.open()
input_file = open('vehicle.spec', 'rt')
data = json.load(input_file, object_hook = spec.from_json)
hvac = ecu.ECU(data['ECUs']['HVAC'], dev)
wanted_values = ['Blower Speed Output', 'External Ambient Temperature', 'Left Solar Radiation Sensor', 'Cabin Temperature']
for value_name in wanted_values:
result = hvac.read_data_by_id(value_name)['value']
print("%s = %.1f %s" % (value_name, result[0], result[1]))
dev.close()
The error I am getting is:
OSError: libicsneoAPI.so.0.1.3: cannot open shared object file: No such file or directory
It sounds like I am missing a dependency, but I am not sure where do download said dependency from.
EDIT: Going off of the API page for Python-Can, under the NeoVi Interface section it mentions the following:
This interface is not supported on Linux, however on Linux neoVI devices are supported via Socketcan with ICS Kernel-mode SocketCAN module for Intrepid devices and icsscand
As such I have been attempting to implement the ICS Kernel-mode SocketCAN module, as well as icsscand. My problem with that at the moment is with the kernel-mode SocketCAN module.
$ git clone https://github.com/intrepidcs/intrepid-socketcan-kernel-module
$ cd intrepid/socketcan-kernel-module
$ make
I am getting an error on the $ make
command which reads:
make -C /lib/modules/4.9.35-v7+/build M=/home/pi/intrepid-socketcan-kernel-module modules
make[1]: *** /lib/modules/4.9.35-v7+/build: No such file or directory. Stop.
Makefile:4 recipe for target 'all' failed
make: *** [all] Error 2
I am not sure if I should just make the directory it is looking for, or if it not being there is a problem I shouldn't have in the first place.
1 Answer 1
Start by installing the dependencies:
sudo apt-get install libftdi1 libftdi-dev
Next download the required package with the following command:
git clone https://github.com/intrepidcs/icsneoapi.git
Change to the new directory:
cd icsneoapi/
Then build the package:
make
Finally, copy the library and headers to the /usr/lib
folder:
sudo cp libicsneoapi.so /usr/lib/
sudo mkdir /usr/include/ics
sudo cp src/icsnVC40.h /usr/include/ics/
sudo cp src/icsneo40API.h /usr/include/ics/
I believe the paths above are correct for the Pi, but they may take a little tweaking.
-
Thanks. I am still getting the error, so I'll see if I need to change any of the file paths and let you know what does or doesn't work. Appreciate the assistance.Skitzafreak– Skitzafreak2017年07月14日 14:52:53 +00:00Commented Jul 14, 2017 at 14:52
-
Try this sudo cp libicsneoapi.so /usr/lib//arm-linux-gnueabihf/Steve Robillard– Steve Robillard2017年07月14日 15:00:09 +00:00Commented Jul 14, 2017 at 15:00
-
That didn't work either. I just made an edit to the OP about some other things i have been trying and hitting errors with.Skitzafreak– Skitzafreak2017年07月14日 15:13:16 +00:00Commented Jul 14, 2017 at 15:13
sudo apt-get
line with no problems, but where exactly would it be installing to since I'd still need to find the folder to run themake
command