collin80 / SavvyCAN

QT based cross platform canbus tool
MIT License
1.03k stars 285 forks source link

PeakCAN not setting speed? #675

Open collin80 opened 1 year ago

collin80 commented 1 year ago

It seems possible that the PeakCAN driver is not taking into account the set speed. 500k seems to work as that's the default but other speeds might be impossible to set. More investigation is in order. But, be warned, Peak adapters might only work at 500k speed right now.

tyalie commented 1 year ago

Is there any more information on this / why it happens? I'm currently running into this issue.

rusoku commented 1 year ago

Just tested on the Peak CAN Pro FD adapter.At least 500, 250, 100 kbit works fine for me.

collin80 commented 1 year ago

I still haven't tested it locally. I do have a PeakCAN adapter but I always use it through socketcan on linux so I'm setting it from the command line. I'll have to try this in Windows with the normal PeakCAN driver to see what is going on.

tyalie commented 1 year ago

Hmh. Is there any kind of debug log what kind of errors happen, if the configuration worked, ...?

Because it works for me on Linux through socketcan, but on Windows it seems to have problems, as my pcan adapter starts to blink red and nothing gets received.

rusoku commented 1 year ago

Add New Device Connection -> Create New Connection -> Select device (!) -> Change speed to 100000 -> Save Bus Settings. It works for me.

tyalie commented 1 year ago

@rusoku did you try it with the "nightly" built?

rusoku commented 1 year ago

1999da8

rusoku commented 1 year ago

kvaser_side Peak+SavvyCAN_side

minoseigenheer commented 1 year ago

1999da8 Do you have a apple silicon (macOS 13.5) compatible build of 1999da8?

rusoku commented 1 year ago

I have compiled several versions older than this for the arm64 Apple silicon (Qt 5.15.16) And serial bus plugin for the Rusoku TouCAN USB adapter series only.Rusoku serial bus plugin is compiled like fat file with support x64 and arm64. I will try this compile (1999da8) version as well in my spare time.

minoseigenheer commented 1 year ago

Thanks for you help. Will that version support all QT supported CAN dongles? Is it hard to get the GitHub action build to compile an arm64 Apple silicon version?

rusoku commented 1 year ago

Qt 5.15.x doesn't have build for the arm64 Qt libraries by default. Need to rebuild all Qt libraries and plugins before.

rusoku commented 1 year ago

SavvyCAN for arm64 aka Apple silicon, commit 1999da8 version: https://www.rusoku.com/downloads/SavvyCAN_arm64_1999da8.zip After download need to remove file from quarantine: xattr -cr FILE_NAME

arm64 version works much faster for me on my M1 AirBook

minoseigenheer commented 1 year ago

SavvyCAN for arm64 aka Apple silicon, commit 1999da8 version: https://www.rusoku.com/downloads/SavvyCAN_arm64_1999da8.zip After download need to remove file from quarantine: xattr -cr FILE_NAME

arm64 version works much faster for me on my M1 AirBook

Thanks for your help. The app works and I can connect to a CAN bus. The weird part is it misses a lot of messages on a busy bus. On a 250kbit bus with 180+ messages per second I only get around 40. If I use SavvytCAN with parallels on windows I receive all messages. The app also seems very slow on my M1-Max macBook.

rusoku commented 1 year ago

I don't see any frames lost.From 500 000 I have received 100% frames with about 780 frames per second on 1Mbit bus speed and 1mS interframe space.If I decrease interframe space down 500uS I get fps speed up to 2000 without frames losses.

Sender: Kvaser Leaf, receiver: Rusoku TouCAN with QtserialBus plugin and low level USB driver compiled for arm64 Apple silicon.

Screenshot 2023-10-26 at 19 38 36
minoseigenheer commented 1 year ago

I don't see any frames lost.From 500 000 I have received 100% frames with about 780 frames per second on 1Mbit bus speed and 1mS interframe space.If I decrease interframe space down 500uS I get fps speed up to 2000 without frames losses.

Sender: Kvaser Leaf, receiver: Rusoku TouCAN with QtserialBus plugin and low level USB driver compiled for arm64 Apple silicon. Screenshot 2023-10-26 at 19 38 36

I tried again but my PCAN is not usable with this build. It looses messages.

tyalie commented 1 year ago

I tried again but my PCAN is not usable with this build. It looses messages.

Does it loose all messages or just some? Because I can also report bus instabilities with SavvyCAN + Peak that I don't have when I use the PCAN-View software. Also: Do you use CAN-FD or not, because there's a great difference there in how QT setups the PCan adapter.

minoseigenheer commented 1 year ago

Does it loose all messages or just some? Because I can also report bus instabilities with SavvyCAN + Peak that I don't have when I use the PCAN-View software. Also: Do you use CAN-FD or not, because there's a great difference there in how QT setups the PCan adapter.

I only lose a part of the messages. But quite a big part on a busy bus. The same setup with SavvyCAN and PCAN on Windows works fine. I have not tried CAN FD.

rusoku commented 1 year ago

Do you use mac-can dylib for the PCAN ? Which version do you use ?

rusoku commented 1 year ago

Just tested PCAN and it works too. From 100 000 sent frames (Kvaser Leaf) I received 100% with interframe space 1uS. Same results as with TouCAN adapter. Low level driver: Mac-can libPCBUSB.0.12.1.dylib PC: Macbook Air M1