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

kvaser usbcan pro is not supported? #19

Open
dhje0ng opened this issue Aug 26, 2022 · 6 comments
Open

kvaser usbcan pro is not supported? #19

dhje0ng opened this issue Aug 26, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@dhje0ng
Copy link

dhje0ng commented Aug 26, 2022

sir. kvaser usbcan pro 2xhs v2 is not supported?
I would like to know if there is a way to use this equipment.

thank you

@mac-can
Copy link
Owner

mac-can commented Aug 29, 2022

Just replace the two attached files in your local repository and rebuild the library.
Pl. send me feedback if it works or not.

USBCAN_Pro_2HS_V2.zip

@dhje0ng
Copy link
Author

dhje0ng commented Aug 30, 2022

/Binaries/can_test "Kvaser CAN Channel 0" -r

but It didn't work. What is the cause?

Available interfaces are printed. (Kvaser CAN Channel 0)

Hardware=Kvaser CAN Channel 0...available
Hardware=Kvaser CAN Channel 1...not available
Hardware=Kvaser CAN Channel 2...not available
Hardware=Kvaser CAN Channel 3...not available
Hardware=Kvaser CAN Channel 4...not available
Hardware=Kvaser CAN Channel 5...not available
Hardware=Kvaser CAN Channel 6...not available
Hardware=Kvaser CAN Channel 7...not available
Number of present CAN interfaces: 1
CAN Tester for Kvaser CAN Interfaces, Version 0.3.1 (0xaaa925f)
Copyright (c) 2007,2020-2022 by Uwe Vogt, UV Software, Berlin

This program comes with ABSOLUTELY NO WARRANTY!

This is free software, and you are welcome to redistribute it
under certain conditions; type `--version' for details.

Hardware=Kvaser CAN Channel 0...FAILED!
+++ error: CAN Controller could not be initialized (-95)
Copyright (c) 2007,2020-2022 by Uwe Vogt, UV Software, Berlin

@mac-can
Copy link
Owner

mac-can commented Aug 31, 2022

/Binaries/can_test "Kvaser CAN Channel 0" -r

but It didn't work. What is the cause?

Have you rebuild everything by make clean ; make all?

To isolate the problem, it is better to use the trial program with option INFO: ./Trial/kvl_test TEST INFO
There is more babbling ;)

@dhje0ng
Copy link
Author

dhje0ng commented Nov 15, 2022

@mac-can sorry for late reply. Sir I checked again and it seems I am still getting the error.
My OS is using Mac OS M1 (ARM) 13.0 (22A380) version.

Can you do some CAN monitoring to see if this is working?

$ ~/Downloads/KvaserCAN-Library make clean
$ ~/Downloads/KvaserCAN-Library make all
$ ~/Downloads/KvaserCAN-Library sudo make install
$ ~/Downloads/KvaserCAN-Library ./Trial/kvl_test TEST INFO
>>> CAN API V3 for Kvaser CAN Interfaces, Version 0.3.1 (0xaaa925f)
>>> myDriver.GetProperty(CANPROP_GET_SPEC): value = 3.0
>>> myDriver.GetProperty(CANPROP_GET_VERSION): value = 0.3
>>> myDriver.GetProperty(CANPROP_GET_PATCH_NO): value = 1
>>> myDriver.GetProperty(CANPROP_GET_BUILD_NO): value = aaa925f
>>> myDriver.GetProperty(CANPROP_GET_LIBRARY_ID): value = 600
>>> myDriver.GetProperty(CANPROP_GET_LIBRARY_DLLNAME): value = 'libUVCANKVL.dylib'
>>> myDriver.GetProperty(CANPROP_GET_LIBRARY_VENDOR): value = 'UV Software, Berlin'
    Loading the MacCAN driver...
    - One device added at location 01140000
      - Device #0: Kvaser USBcan Pro 2xHS v2
        - Properties: vendor = bfd, product = 108, release = 0001, speed = 2
    - Run loop started so notifications will be received
>>> CCanAPI::ProbeChannel(0): state = available
+++ Sorry, device #1 is not available
>>> CCanAPI::ProbeChannel(1): state = not available
+++ Sorry, device #2 is not available
>>> CCanAPI::ProbeChannel(2): state = not available
+++ Sorry, device #3 is not available
>>> CCanAPI::ProbeChannel(3): state = not available
+++ Sorry, device #4 is not available
>>> CCanAPI::ProbeChannel(4): state = not available
+++ Sorry, device #5 is not available
>>> CCanAPI::ProbeChannel(5): state = not available
+++ Sorry, device #6 is not available
>>> CCanAPI::ProbeChannel(6): state = not available
+++ Sorry, device #7 is not available
>>> CCanAPI::ProbeChannel(7): state = not available
      + Device #0: asynchronous event source added to run loop
        - Message pipe of size 512 bytes
        - Message queue for 65536 elements of size 88 bytes
        - Double buffer each of size 512 bytes for endpoint #1
+++ error: myDriver.InitializeChannel(0) returned -95
Cheers!

@dhje0ng
Copy link
Author

dhje0ng commented Nov 15, 2022

KvaserCAN-Library/Examples/Python 1 » python3 can_recv.py --channel 0
CAN API V3 for generic CAN Interfaces (Python Wrapper 0.1.1)
>>> can = CANAPI(libUVCANKVL.dylib)
>>> can.init(0, 0x00)
+++ error: can.init returned -95

I used can_recv.py in the Examples/ directory to test it. but it doesn't seem to work

@mac-can
Copy link
Owner

mac-can commented Nov 15, 2022

@mac-can sorry for late reply. Sir I checked again and it seems I am still getting the error. My OS is using Mac OS M1 (ARM) 13.0 (22A380) version.

Can you do some CAN monitoring to see if this is working?

$ ~/Downloads/KvaserCAN-Library make clean
$ ~/Downloads/KvaserCAN-Library make all
$ ~/Downloads/KvaserCAN-Library sudo make install
$ ~/Downloads/KvaserCAN-Library ./Trial/kvl_test TEST INFO
>>> CAN API V3 for Kvaser CAN Interfaces, Version 0.3.1 (0xaaa925f)
>>> myDriver.GetProperty(CANPROP_GET_SPEC): value = 3.0
>>> myDriver.GetProperty(CANPROP_GET_VERSION): value = 0.3
>>> myDriver.GetProperty(CANPROP_GET_PATCH_NO): value = 1
>>> myDriver.GetProperty(CANPROP_GET_BUILD_NO): value = aaa925f
>>> myDriver.GetProperty(CANPROP_GET_LIBRARY_ID): value = 600
>>> myDriver.GetProperty(CANPROP_GET_LIBRARY_DLLNAME): value = 'libUVCANKVL.dylib'
>>> myDriver.GetProperty(CANPROP_GET_LIBRARY_VENDOR): value = 'UV Software, Berlin'
    Loading the MacCAN driver...
    - One device added at location 01140000
      - Device #0: Kvaser USBcan Pro 2xHS v2
        - Properties: vendor = bfd, product = 108, release = 0001, speed = 2
    - Run loop started so notifications will be received
>>> CCanAPI::ProbeChannel(0): state = available
+++ Sorry, device #1 is not available
>>> CCanAPI::ProbeChannel(1): state = not available
+++ Sorry, device #2 is not available
>>> CCanAPI::ProbeChannel(2): state = not available
+++ Sorry, device #3 is not available
>>> CCanAPI::ProbeChannel(3): state = not available
+++ Sorry, device #4 is not available
>>> CCanAPI::ProbeChannel(4): state = not available
+++ Sorry, device #5 is not available
>>> CCanAPI::ProbeChannel(5): state = not available
+++ Sorry, device #6 is not available
>>> CCanAPI::ProbeChannel(6): state = not available
+++ Sorry, device #7 is not available
>>> CCanAPI::ProbeChannel(7): state = not available
      + Device #0: asynchronous event source added to run loop
        - Message pipe of size 512 bytes
        - Message queue for 65536 elements of size 88 bytes
        - Double buffer each of size 512 bytes for endpoint #1
+++ error: myDriver.InitializeChannel(0) returned -95
Cheers!

Your device is detected and added to the device list:

  Loading the MacCAN driver...
   - One device added at location 01140000
     - Device #0: Kvaser USBcan Pro 2xHS v2
       - Properties: vendor = bfd, product = 108, release = 0001, speed = 2
   - Run loop started so notifications will be received

Also the MacCAN core layer has done its job:

    + Device #0: asynchronous event source added to run loop
       - Message pipe of size 512 bytes
       - Message queue for 65536 elements of size 88 bytes
       - Double buffer each of size 512 bytes for endpoint #1

But I miss one log message before the error message:

+++ error: myDriver.InitializeChannel(0) returned -95
Cheers!

The trial program should print the following line before calling myDriver.InitializeChannel:

    Initializing Kvaser Leaf Pro HS v2 driver...

It seems that the configuration settings are not correct.

If you have the possibility to debug the trial program, you can set a breakpoint on function Mhydra_ConfigureChannel in the file KvaserCAN_Driver.c (line 106) and step through it to see which parameter causes the error. Or place some printf statements in the function.

Happy debugging ;)

@mac-can mac-can added the enhancement New feature or request label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants