08-02-2022 12:04 PM
I've been trying to develop a VI in LabView to achieve communication using J1939 protocol to send and receive messages to a controlled switching module. This module has internal properties based on it's address which is set using CAN and can report on electrical signals going through the device, such as voltage and current. I am having trouble creating initial communication between LabView and the module. I am using the NI USB-8502 and only focusing on CAN A currently. When I try and send a packet, I do not get any response in the front panel of the LabView program. I hooked up an oscilloscope and am observing a continuous 1-off pulse that occurs at a constant interval. I am not currently using the NI-MAX version of LabView-CANBUS implementation as I do not have a CANdB file for the device. Any suggestions on why I would be only receiving the constant 1 pulse would be greatly appreciated and how I might achieve desired communication.
Thanks,
Matthew
08-02-2022 12:54 PM
Hi Matt,
what have you tried so far?
Why don't you attach your VI?
Which messages does oyur device expect?
Which messages does your device send?
Mind to attach a manual of your device (or a link to it)?
What is a "1-off pulse" for CAN communication?
08-09-2022 09:11 AM
Hello Gerd,
So far I have tried 2 examples from LabView "J1939 Frame Input Stream" along with "J1939 Frame Output Stream" and "J1939 NI CAN Frame Example". I have my parameters set as follows for the Input and Output Stream:
I've attached the ICD for the device I am using. The interface I have is the USB-8502 but am only focusing on one CAN channel for now. I have an oscilloscope probing the pin that has CAN+ and do not get any reading on the scope.
The company we received the device from is working on a LabView driver but have not figured it out completely. It is a modified version of the "J1939 NI CAN Frame Example.vi". This one is where I get the "one-off" pulse which was a short pulse that lasted maybe 1 ms and had a low voltage but I am unable to repeat that now. An issue I ran into was I don't have a .dbc file to use with XNET.
I've attached the VI from the company I have been trying to get working but am having no luck.
Thanks,
Matt
08-09-2022 09:31 AM - edited 08-09-2022 10:01 AM
First glance at your code I see you have three Dequeues on the same Queue
That is not going to work reliably as you have a dequeue race condition.
Whichever loop dequeues first is the only one that gets the queued element.
A queue can have more than one enqueue but only one dequeue.
On closer inspection I DO NOT see a enqueue at all? But what I said above about multiple dequeue still holds true...
Here's an example of my last CAN bus project.
Notice there is just one dequeue and I decide what to do with the packet based on the Arbitration ID and Payload ID
08-09-2022 10:01 AM - edited 08-09-2022 10:11 AM
I opened the block diagram for the "J1939 NI CAN Frame Example.vi" that the company has said their vi driver is based on. I do not see any enque VIs there as well. The data wire passes a J1939 cluster that contains a "Processed incoming" element to the dequeue that has a queue refnum so I am assuming data is queued with the "J1939 Initialize.vi" for incoming messages or for outgoing messages the "Data to send" is input directly to the dequeue. The example vi is directly from NI's examples found here https://forums.ni.com/t5/Example-Code/J1939-Transport-Protocol-Reference-Example/ta-p/3984291. I would expect no modifications would need to be implemented but it may be obsolete.
I opened up the sub vi for "J1939 Initialize.vi" and there are 3 "obtain queue" vis, one for Can Data Output, CAN Output, and CAN Generation Loop. I appreciate your time, I am just learning how to implement CAN and am trying to look at this issue from multiple perspectives.
Thanks,
Matthew
09-12-2024 08:05 AM
can you please tell me the name of the bookstore for canbus?
09-15-2024 09:51 PM
@NORA2200 wrote:
can you please tell me the name of the bookstore for canbus?
Lol bookstore, maybe you are looking for the library.