LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN question

I have a general question about CAN. I have a CAN device to which I am trying to communicate using a CAN Ethernet adapter. Adapter is the PCAN Ethernet Gateway DR. So I have set up the ID address and set everything up and then I communicated with the CAN device which is the IVTS from ISAscale using the PCAN software called PCAN View and it worked perfectly. But the problem is in the software I only need to enter the CAN ID and the Data and software calculates everything else like Start of Frame, CRC check, End of Frame etc. But that is not possible in LabVIEW. In LabVIEW I plan on sending the whole CAN frame via TCP/IP and read the response via TCP/IP. I tried creating a connection by using TCP Open connection and it works, Not I just need to use TCP Write to send the CAN frame, but I don't know how to calculate the entire CAN frame. I have the CAN ID and the Data to send from the datasheet of IVTS from ISAscale, but rest of the data for CAN frame I have no idea. Can you please educate forward me to any link or source on how to calculate the remaining stuff for a CAN frame. Thank you. 

0 Kudos
Message 1 of 17
(517 Views)

Hi govindsankar,

 


@govindsankar wrote:

Adapter is the PCAN Ethernet Gateway DR.

 

I tried creating a connection by using TCP Open connection and it works, Not I just need to use TCP Write to send the CAN frame, but I don't know how to calculate the entire CAN frame. I have the CAN ID and the Data to send from the datasheet of IVTS from ISAscale, but rest of the data for CAN frame I have no idea.


I guess you already read the manual for your PeakCAN Ethernet adapter, did you?

What does it say about the format of the TCP message to send a CAN frame?

 

Do you really need to provide all the low-level details of the CAN message or does the driver/hardware automatically handle those details?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 17
(492 Views)

Is there a reason you want to do this with raw TCP/IP?

 

I have not used their ethernet devices, but I believe they are supported by the PCAN-Basic API.

0 Kudos
Message 3 of 17
(470 Views)

@GerdW, sorry my mistake. I did read the manual, it wasnt there, but there is another document called developer documentation.

govindsankar_2-1721991586196.png

 

I took this page out of there.  It tells me about the different data in CAN frame but dont dont know how to get it. I know CAN ID and CAN Data, but rest I dont know. I am thinking length I need to sit and calculate after writing everything else down. Message type is 81 itself. Then I dont know what does it mean by not used in the current version. Do i have to leave it or enter 0. Also timestamp should I leave it or should I write 0. Even CAN ID, I am not sure. The CAN ID i know is 209h, but i am not sure how will I write it here. And finally checksum calculation is also something i didnt understand. 

crc32([0x08, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88]) = 0x20861949

So I am trying to figure out all this. Ok CAN programming in LabVIEW without NI hardware is really hard and the NI hardware is super expensive. Otherwise my company would have bought NI hardware. Anyway I will try to figure this out. Could use any help though. Thank you. 

0 Kudos
Message 4 of 17
(428 Views)

The PCAN basic API uses a .dll which is 32 bit and my labview is 64 bit and it doesnt work. So I have to use raw TCP/IP.  

 
0 Kudos
Message 5 of 17
(426 Views)

Hi govindsankar,

 


@govindsankar wrote:

The PCAN basic API uses a .dll which is 32 bit and my labview is 64 bit and it doesnt work. So I have to use raw TCP/IP.  

 

You can install LabVIEW 32 bit with your license!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 17
(420 Views)

Hi govindsankar,

 


@govindsankar wrote:

Ok CAN programming in LabVIEW without NI hardware is really hard and the NI hardware is super expensive. Otherwise my company would have bought NI hardware.


How much time did you already need to implement CAN communication? How much does your employer pay per hour? Are you so cheap that you couldn't afford a CAN interface from NI (by now)???

 

  • Timestamp data is quite irrelevant as described in this image.
  • Checksum is explained "in the following chapter"!

What else do you need?

 

I don't understand why you don't use the API provided by Peak for their hardware...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 17
(417 Views)

PCAN basic has both 32 and 64 bit.

 

Frozen_0-1722000237387.png

 

I *just* implemented a simple CAN bus test using the USB PEAK HW.

---------------------------------------------
Certified LabVIEW Developer (CLD)
0 Kudos
Message 8 of 17
(401 Views)

can you send it to me. Also i am using ethernet. So i dont know whether this API will work with ethernet.  The one I found online was just 32 bit. 

0 Kudos
Message 9 of 17
(397 Views)

Two different packages needed

 

Drivers:  https://www.peak-system.com/Drivers.523.0.html?&L=1

SW:   https://www.peak-system.com/Development.526.0.html?&L=1

and it does support eithernet.

 

Frozen_0-1722001165994.png

 

Frozen_1-1722001415995.png

 

 

Good luck!

 

 

---------------------------------------------
Certified LabVIEW Developer (CLD)
0 Kudos
Message 10 of 17
(391 Views)