Author Topic: CANbus development tools  (Read 9359 times)

0 Members and 2 Guests are viewing this topic.

Offline Gabri74

  • Regular Contributor
  • *
  • Posts: 107
  • Country: it
Re: CANbus development tools
« Reply #25 on: August 19, 2019, 12:23:28 pm »
I know you already bought one, but I'll leave this for other people looking for something similar:

https://www.8devices.com/products/usb2can_korlan

Comes with python and wireshark support.

I've bought the old usb2can model and I'm very happy with it. I use it in linux (socketcan)
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: CANbus development tools
« Reply #26 on: August 19, 2019, 04:15:53 pm »
This question about CAN dev tools has come up here before, and in that thread I mentioned we use the Peak CAN tools. Peak has already been covered in this thread so I won't repeat myself, other than to say we've had great success with them and have ended up purchasing quite a few more CAN-USB interfaces from them. The free version of their PC software has proven incredibly useful and we've had no reason to buy any of the pay-for versions.

However, this thread does give me the chance to raise a related topic. We are considering developing a bootloader for our PIC18F-based CAN products. The firmware side is straightforward, but we haven't nailed down the PC side of things. Peak has a library which we've downloaded but we haven't actually tried yet. Anyone here ever implemented a CAN bootloader? What did you use for the PC side of things? We'd need the ability to send and receive CAN messages under the control of our own in-house PC application software.

Thanks!
 

Offline Gabri74

  • Regular Contributor
  • *
  • Posts: 107
  • Country: it
Re: CANbus development tools
« Reply #27 on: August 19, 2019, 04:28:30 pm »
We are considering developing a bootloader for our PIC18F-based CAN products. The firmware side is straightforward, but we haven't nailed down the PC side of things. Peak has a library which we've downloaded but we haven't actually tried yet. Anyone here ever implemented a CAN bootloader? What did you use for the PC side of things? We'd need the ability to send and receive CAN messages under the control of our own in-house PC application software.

I've done it in the past. We used a PDO for sending chunks (PC->board) and another PDO for ack (boars->PC).

If you are on linux you can use libsocketcan with raw frames or a simple CanFestival based app.

If you are on windows I think the simplest approach is to use Qt with QtCanBus and raw frames (be aware that this Qt module could be under (L)GPLv3, so if you need to sell/distribute your PC application check it in advance.

https://doc.qt.io/qt-5/qtcanbus-backends.html

Also see this for some examples:

https://www.embeddeduse.com/category/can/
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: CANbus development tools
« Reply #28 on: August 19, 2019, 04:33:31 pm »
Thanks for the reply!

If you are on linux you can use libsocketcan with raw frames or a simple CanFestival based app.
Nope, Windows here.


Quote
If you are on windows I think the simplest approach is to use Qt with QtCanBus and raw frames (be aware that this Qt module could be under (L)GPLv3, so if you need to sell/distribute your PC application check it in advance.
We have zero experience with Qt, so that's a steep learning curve for this one in-house project. (No distribution problems, we'd only use it in-house so we can build in volume and flash on the production floor to configure for shipments.) I was hoping more for a Windows DLL that could be linked into a custom app we'd write for this purpose in Visual C/C++.
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: CANbus development tools
« Reply #29 on: August 19, 2019, 05:57:36 pm »
My colleague developed both a python based CAN firmware upgrade tool and a C# one.

PeakCAN has support built into the PythonCAN module.

The driver is just that, just allows your code to send/receive CAN packets.
The real development work comes with the CAN protocol.

With a protocol stack, you just create functions which call functions like
sdoWrite( cobAdr, *data, datlength, NONEXPIDITED );
Then the entire data transmission and error detect is all done by the stack.
(This is for CANopen CAN protocol)

If you are using a user defined CAN protocol, then you will have to develop the stack yourself.

Does that answer your question?
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4079
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: CANbus development tools
« Reply #30 on: August 19, 2019, 06:13:24 pm »
Many cheap CAN to USB adapters simply create one virtual com port endpoint and cannot handle a busy bus (low packet per second rating). You must set hardware filters.
The Leaf light Kvaser can handle (and transmit!) maximum packet rate for CAN bus.* Probably PEAK as well, but last time I checked they still mounted as a virtual com port, which means it's exclusive to one application.
Kvasers USB driver is amazing, you can run hundreds apps on one interface, exchange it for the LAN/WiFi version and run the same app.

However, many software made by german vendors only support PEAK.

Yes, €300 for a CAN to USB might sound expensive, but can you make one including the usb driver for less?
Also, if you've put the Kvaser drive to use in app, you can just build a small app for everything you need it for. You can even tie it to labview.
I made this example way back. I have now made a kvaser class in Qt, but that is proprietary unfortunately. https://github.com/Jeroen6/QtKvaser
While I did that Qt announced QtCAN.... but that only supported PEAK in the first version.

*Ideal for bootloaders in production programming.
« Last Edit: August 19, 2019, 06:15:18 pm by Jeroen3 »
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: CANbus development tools
« Reply #31 on: August 20, 2019, 02:47:46 am »
I'll look closer at Kvaser, thanks!

Meanwhile, I've found that Peak provides a J2534 pass-through API that appears useful, and callable from a C/C++ application (their examples are in C). It has the ability to set filters, read and write CAN messages, etc. Not sure of its throughput but at least it's low-level enough to support externally defined filters. It even has a way to create a separate thread to transmit a periodic message with 1mS resolution. Since we have an investment in Peak CAN hardware already, I'll probably start there and see how it pans out while researching the Kvaser options.

Here's the link to the Peak pass-through library (Win7-10, 32/64 bit):

https://www.peak-system.com/fileadmin/media/files/PCAN-PassThru.zip
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17838
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: CANbus development tools
« Reply #32 on: August 20, 2019, 06:51:28 am »
I picked Kvaser because they seem to be supported and themselves advertise 3rd party programmes so I sespect that they are more univesally usable than Peak. And having experienced peak software i'll take the chance on something else.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: CANbus development tools
« Reply #33 on: August 20, 2019, 07:36:19 pm »
Have just finished looking at the Kvaser API. I agree, it's very nice and definitely superior (at least in its documentation) to the Peak API. I'm also grateful the DB9 pinouts are compatible on the pins we care about! (Yes, that's supposed to be standardized, but "The nice thing about standards is that there are so many different ones to choose from."   |O)

Reading the Kvaser docs, and especially their sample code and comments, is refreshing after the garbage so many other companies put out.

But the proof will be in the performance and behavior of the API's when they integrate with our own in-house C/C++ apps for flashing through the bootloader. As I said, we have quite a bit invested in Peak hardware already, so I may take a stab at getting the Peak API to work just to leverage what we already own. Kinda wish we'd gone with Kvaser to start now, though.

Thanks for the pointer to Kvaser's API!
 

Offline Totoxa

  • Newbie
  • Posts: 9
  • Country: cl
Re: CANbus development tools
« Reply #34 on: August 21, 2019, 04:36:18 pm »
CANalyser is the defacto standard in automotive industry.
It not only logs messages with time stamps.
It does real time message decoding if you supply the message format in a .dbc file.
Vector provide a .dbc edit as part of CANalyser.

You can do the same in windows with BusMaster and in linux with SavvyCAN for free
 
The following users thanked this post: Gabri74

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4079
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: CANbus development tools
« Reply #35 on: August 21, 2019, 09:03:44 pm »
Thanks for the pointer to Kvaser's API!
Your welcome. If you have any questions, I can probably answer them. As I'm working on a kvaser application for the coming weeks again.
 

Offline Gabri74

  • Regular Contributor
  • *
  • Posts: 107
  • Country: it
Re: CANbus development tools
« Reply #36 on: August 22, 2019, 09:27:22 am »
You can do the same in windows with BusMaster and in linux with SavvyCAN for free

Thanks a lot for SavvyCAN, didn't know it!
 

Offline Ribster

  • Frequent Contributor
  • **
  • Posts: 250
  • Country: be
  • Electronics prototyper. Design. Prototype. Consult
    • Ash Labs
Re: CANbus development tools
« Reply #37 on: August 27, 2019, 10:43:33 am »
Take a look at USBTin
https://www.fischl.de/usbtin/

Friend of mine used it in conjunction with an STM32 which ran OpenCAN. He used the scripting stuff to get load testing out of it.
He found some firmware functional bugs with it.
www.ashlabs.be
Design and manufacturing of embedded hard- and software
 

Offline k8943

  • Regular Contributor
  • *
  • Posts: 100
  • Country: be
Re: CANbus development tools
« Reply #38 on: January 26, 2020, 06:00:18 am »
@Simon which software package did you end up using with your Kvaser?

(I'm looking for instant useful upgrade from Microchip Canbus Analyzer, then ONE day might create an app...;) )
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17838
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: CANbus development tools
« Reply #39 on: January 26, 2020, 09:24:06 am »
nothing yet. I need to get a CAN bus working on a chip first.
 

Offline k8943

  • Regular Contributor
  • *
  • Posts: 100
  • Country: be
Re: CANbus development tools
« Reply #40 on: January 26, 2020, 09:48:12 am »
I thought CANBUS was going to be complex in terms of libraries etc and so found other ways of doing things. Then realised that with PIC18F26K83 + MCC ("Microchip Chip Configurator" plugin for MPLABX IDE) + a chip like ATA6561  it's actually pretty straightforward. Onwards and upwards.
 

Offline Scrts

  • Frequent Contributor
  • **
  • Posts: 798
  • Country: lt
Re: CANbus development tools
« Reply #41 on: January 26, 2020, 09:20:46 pm »
 

Offline Gabri74

  • Regular Contributor
  • *
  • Posts: 107
  • Country: it
Re: CANbus development tools
« Reply #42 on: January 27, 2020, 09:16:55 am »
Did anyone try Chinese stuff? Do they work with can-utils?

I will not suggest to buy a cheap chinese CAN adapter for several reasons:

1. If you work with CAN, probably you are interfacing with motors controllers or inverters or industrial buses, an isolation in those
applications is really important. You don't want to blew your PC motherboard due to poor isolation...

2. They are often clones of other products and steal/modify original vendor USB drivers. Also never install supplied drivers in windows, the risk of installing viruses are too high

3. The vast majority of cheap linux compatible CAN adapters use the slcan (serial) interface: they are basically CAN-to-serial adapters bridged over USB, and often can't cope well with high CAN speeds.

If you are using linux, I strongly suggest to choose an adapter with official socketcan support.
 

Offline Sal Ammoniac

  • Super Contributor
  • ***
  • Posts: 1696
  • Country: us
Re: CANbus development tools
« Reply #43 on: January 27, 2020, 05:16:20 pm »
I've used the Komodo Can analyzer by Total Phase at work that comes in both single and dual port.  Also not that cheap around $450.  The stock software is pretty good and it come with a C and python library.

I can't recommend the Komodo CAN analyzer sold by Total Phase. I have one and it has several issues. For one, the Komodo GUI software is buggy. I've never been able to keep it running for more than a few days. This makes it really difficult to diagnose CAN issues that only show up after days to weeks.

Another issue is that the GUI cannot set an arbitrary bit rate. You have to use one of the rates supported by the application. This makes it useless for debugging on a CAN bus that uses a non-standard bit rate.
Complexity is the number-one enemy of high-quality code.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf