intrepidcs / python_ics

Library for interfacing with Intrepid devices in Python
MIT License
61 stars 29 forks source link

Problem upon creating bus using neovi #166

Closed 8Klaro8 closed 8 months ago

8Klaro8 commented 9 months ago

Dear Intrepid,

I'd like to create a bus using the can python library and I's like to open it using neovi as my driver.

The python script looks like this: `import can

neovi_bus = can.interface.Bus(bustype="neovi",channel=1,bitrate=115200)`

Once the script tries to open/create the bus, I am getting this error: Traceback (most recent call last): File "C:\Users\bhuroger\AppData\Roaming\Python\Python311\site-packages\can\bus.py", line 446, in __del__ self.shutdown() File "C:\Users\bhuroger\AppData\Roaming\Python\Python311\site-packages\can\interfaces\ics_neovi\neovi_bus.py", line 257, in shutdown ics.close_device(self.dev) ics.ics.RuntimeError: Error: close_device(): icsneoClosePort() Failed Test Serial Connection | FAIL | Setup failed: Error: open_device(): icsneoOpenDevice() Failed

Facts: I am looking for quite a time now and still no luck finding the solution. As far as I am concerned, the configuration is well done. The intrepid driver is present and up-to-date. Necessary package: ics_python is installed. Using the ics_python library I confirmed that the Neovi device is present.

If there is any info I left out, please let me know and I'll provide it ASAP.

Thank you in advance!

drebbe-intrepid commented 9 months ago

@8Klaro8 Can you provide me with the following:

  1. Windows version (32-bit or 64-bit also)
  2. python version
  3. python_ics version
  4. icsneo40.dll version
  5. Which Intrepid product are you using?
8Klaro8 commented 9 months ago

Hi David,

Thank you for the swift response. I realized what was the issue on this matter, however a new arised.

The problem on the previous matter seems to be a connection issue. I am using vehicle spy and when vehicle spy was open and it was sending signals, my python script could not open the device since it was already opened by vehicle spy.

The new problem, however gives the next error message: ValueError: channel must be an integer or a valid ICS channel name NeoViBus was not properly shut down EXCEPTION: 'NeoViBus' object has no attribute 'dev'

Earlier I gave "1" as the channel parameter, however I need to connect to a network called "HS CAN4". I understand that it is not a valid channel for neovi, although I don't understand how to connect to the channel and received the signals.

I give the asked informations too:

  1. Windows version (32-bit or 64-bit also): 64 bit
  2. python version: Python 3.11.6
  3. python_ics version: python-ics 912.4.post1
  4. icsneo40.dll version: I am not sure how to find it
  5. Which Intrepid product are you using?:

Neovi Fire 2

Thank you for your help in advance!

Robin Gergelyfi

David Rebbe @.***> ezt írta (időpont: 2023. nov. 21., K, 21:58):

@8Klaro8 https://github.com/8Klaro8 Can you provide me with the following:

  1. Windows version (32-bit or 64-bit also)
  2. python version
  3. python_ics version
  4. icsneo40.dll version
  5. Which Intrepid product are you using?

— Reply to this email directly, view it on GitHub https://github.com/intrepidcs/python_ics/issues/166#issuecomment-1821669192, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONFBTYNBXKJLMLVIG2EGO3YFUIXPAVCNFSM6AAAAAA7UOWLJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRRGY3DSMJZGI . You are receiving this because you were mentioned.Message ID: @.***>

pierreluctg commented 9 months ago

@8Klaro8, 115200 is not a valid bit rate. For MS/HS networks valid values are 2000, 33333, 50000, 62500, 83333, 100000, 125000, 250000, 500000, 800000 and 1000000.

For the channel value there are 3 ways you can specify the channel for the neovi interface in python-can:

import can
import ics

# Use the network id value for HSCAN4
with can.interface.Bus(interface="neovi", channel=61, bitrate=500000) as bus:
    print(bus)

# Use "HSCAN4" string
with can.interface.Bus(interface="neovi", channel="HSCAN4", bitrate=500000) as bus:
    print(bus)

# Use "NETID_HSCAN4" constant from the ics module (ics.NETID_HSCAN4 == 61)
with can.interface.Bus(interface="neovi", channel=ics.NETID_HSCAN4, bitrate=500000) as bus:
    print(bus)
8Klaro8 commented 9 months ago

Thank you a lot!

drebbe-intrepid commented 8 months ago

closing this as complete, please feel free to re-open if needed.