07-25-2024 07:47 AM
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.
07-25-2024 08:42 AM
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?
07-25-2024 11:55 AM
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.
07-26-2024 06:36 AM - edited 07-26-2024 06:39 AM
@GerdW, sorry my mistake. I did read the manual, it wasnt there, but there is another document called developer documentation.
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.
07-26-2024 06:38 AM
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.
07-26-2024 06:47 AM
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!
07-26-2024 06:54 AM
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)???
What else do you need?
I don't understand why you don't use the API provided by Peak for their hardware...
07-26-2024 08:24 AM
PCAN basic has both 32 and 64 bit.
I *just* implemented a simple CAN bus test using the USB PEAK HW.
07-26-2024 08:32 AM
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.
07-26-2024 08:43 AM
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.
Good luck!