Using Labview to control a servo drive with CAN

I am using a USB-CAN V2 (compact) and Labview 2019 to communicate with a servo drive that uses CANopen. I am struggling mightily to get anything useful to happen. The sample programs provided by IXXAT are not especially useful. They do not generate any errors, but neither do they do anything practical. I am unable to find any labview VIs that get past the recognition of the USB/CAN interface and the mere fact that there is a CAN bus there. The assorted user manuals and guides I can find all seem to use different terms to describe the same thing, making it so far impossible for me to get anywhere. I would really appreciate a simple, sample, of a functioning, transactional VI - i.e. one that asks for data and receives it back; that may help me translate the information in the hardware’s CAN manual into the right settings needed for the IXXAT VIs.

FYI, I have roughly 15 years experience with Labview and exactly 0 successful instances of anything related to CAN communications.

Thanks,

Hello Charles,

I have opened you a case for this on Mysupport.hms.se You should be able to use your email to recover a password to login and access you support account. Here

I am using this case to reach out to the ixxat support team who should be able to help us with the labview example.

Deryck

  1. Please install the VCI V4.0.939.0 and
    the LabView API-Addon V4.0.33 Installation.exe
    from the Add-ons directory of the ZIP file:
    https://www.ixxat.com/technical-support/resources/downloads-and-documentation?ordercode=1.01.0281.12001

  2. The examples are in the following directories:
    C:\Program Files\National Instruments\LabVIEW 2017\examples\IXXAT\VCI.V30\VCI3_Demo.vi
    C:\Program Files\National Instruments\LabVIEW 2017\examples\IXXAT\VCI.V40\VCI4_CANDemo.vi

  3. The HMS IXXAT VCI VIs are in the following directories:
    C:\Program Files\National Instruments\LabVIEW 2017\vi.lib\IXXAT
    C:\Program Files\National Instruments\LabVIEW 2017\vi.lib\IXXAT\VCI
    C:\Program Files\National Instruments\LabVIEW 2017\vi.lib\IXXAT\VCI.V40

  4. Unfortunately we do not have any manuals for the LabView, but
    the C-API manual can be used
    because the LabView API has the same functions with the same parameters.

  5. I hope that the attached additional programming example helps

  6. For the CANopen we can recommend the use of our CANopen Master API,
    that installs also the LabView programming example.

  7. exactly 0 successful instances of anything related to CAN communications.

    I would recommend the check of the communication with the canAnalyser V3 mini
    before the use of the LabView.

2020-11-18-VCI4-Demo-Scheduler-Example.zip (577.0 KB)

Deryck,

Thanks for your response. I already have all the IXXAT software, including VCI 3 and 4, and the CANopen Master API. My issues are primarily the lack of knowledge and experience. From what I can tell, the VCI interface seems to work; i.e. the CAN led on the usb converter flashes green when I try to send messages. My issue with VCI is that it is a bit lower-level than CANopen, and the software manual for the drive I am trying to talk to is all CANopen.

The CANopen examples provided with the CANopen Master API do not seem to work at all. I say that because the CAN led on the USB converter does not flash at all. On copies of those examples that I modified; or other attempts to create programs my self, the CAN led may flash RED, but that is the closest I’ve gotten with any of the CANopen functions.

Further complicating the issue is just not knowing or understanding the chain of events necessary to communicate effectively with my device. My device is preconfigured, with a number of TPDOs and RPDOs; so do I need to ‘create’ PDOs in my software? Do I need to do something to ‘start’ the PDOs in the drive? Referring to the image attached to this email, I feel like it should be fairly straightforward to retrieve the ‘DC Bus Voltage’ from my device. The TPDO is 26, COB-ID/index it 491/200F:01. The device is node 1. It should be easy, but the most I can get is a flashing RED led. Also, note that CAN Analyzer will not run on my system at the same time as the labview program; so I have no ability to ‘spy’ the network for clues. If I m using the VCI functions, I get a ‘VCI error/access denied’. Using the CANopen/Xat dll the error is different, the same sort of issue.

I also have 2 versions of Labview that I have been trying – 2019 32 bit and 2019 64 bit. The 32 bit version has the National Instrument’s (Labview) version of CANopen, but it does not recognize the IXXAT usb2can converter, so any NI generated examples or help is useless.

FYI the example in attached in your message the best I got was a flashing RED led, but to be fair I did not play with it too much.

Thanks,

Hi Charles,
Do you have the CANopen Master API? canopen-master-api-manual-english.pdf (hms-networks.com)
CANopen is a complex protocol. A general very general overview to make sure we are on the same page is you will have RPDO’s (Read Process data Objects) and TPDO’s (TranmitPDO’s). Where a device is configured with a TPDO that sends data to another devices RPDO.

You mentioned that the device already has PDO setup. Do you know how they are configured? Does it power on in run mode and start sending messages? You should be able to connect to it with canAnalyser mini and log the traffic to determine this. What I am thinking is that if your device is setup to send these automatically you might be able to simply configure PDO’s on the master that match. Have you looked at the CANopen master API doc linked above this might help with configuring the nodes.

Deryck

Deryck,

The PDOs in the drive are configured as either “SYNC CYCLIC” or “ASYNC” per the language of the configurator. The RPDOs are all “ASYNC”. Since my last message, I have been able to use canAnalyzer to capture some traffic. I can confirm that there is bus traffic at all times when powered up. I was also able to identify TPDO 26 (shown in the image file I sent with my last post), and parse out the DC bus voltage from the data. I think I can conclude from this that ‘ASYNC’ is roughly the equivalent to a broadcast, and simply puts its data on the CAN bus at whatever interval it is capable (or set up for). I am capturing communications between a compiled labview *.exe program, and 2 nodes – master and slave servo drives. I am guessing that the PDOs configured as “SYNC CYCLIC” are only transmitted to the CAN bus when requested by the host (in my case, the ‘host’ is the PC running the labview program)? I further assume that messages sent to the CAN bus must then be retrieved by the host? If all those assumptions are correct, then what I am trying to learn is what process is needed in the host/labview software to retrieve messages from the CAN bus. The CANopen Master API has ‘create PDO’, ‘read PDO’, ‘read PDO_S‘, ‘request PDO’, ‘write PDO’, and ‘write PDO_S’ available, as well as a ‘deletePDO’. The question is, which of those functions do I use to retrieve data from the CAN bus? Do I need to ‘create PDO’s in labview to mirror those configured on my drives? Would I create a RPDO in labview to mirror a TPDO on the drives?

I do have all the documentation with the Master API. It looks pretty good, but starting from scratch it isn’t super helpful. The sample programs don’t work and also don’t generate any errors; that amongst the many variables I am working with and not having a single ‘known good’ system to compare to make this pretty difficult for me. Unfortunately the source code for the above-referenced labview *.exe program is unavailable.

Thanks,

This sounds roughly correct. The data is produces as determined by the device.

A PDO that uses sync is sent after a X amount of sync messages are received. The sync messages are sent from a sync producer.
This site has details on transmitting PDOs asynchronously and synchronously.

PDO services (canopensolutions.com)

A transmit PDO needs to have a corresponding Receive PDO on the device you want to consume the data with. I would expect you to have matching ones on the master.