08-12-2015 04:58 AM
Hello guys,
i'm using XNET to write only one Frame and then to read its response on the same port. But as you see in the attached VI, i can't get any response at all. For example, i send a frame with ID "0X5F9" out, the response schould be "0X123", but i get nothing back.
Could anyone tell me how to capture the response without using the loop. Thanks!
08-12-2015 07:28 AM
Do you need a delay or a timeout before seeing your response? As set up you're immediately reading after transmission with a timeout of 0.
Try increasing the timeout on your read or adding a delay before reading.
08-12-2015 08:11 AM
Thank you for your reply. But it still doesn't work. After i had set the timeout into 0,25s or some number else, i got always timeout error...
08-12-2015 08:18 AM
@mexaviesta wrote:
Thank you for your reply. But it still doesn't work. After i had set the timeout into 0,25s or some number else, i got always timeout error...
Well then I'd say your device doesn't respond within that timeout. I'd set the timeout to something large like on the order of multiple seconds. If your device returns in 500ms then your function will return, because you are looking for one frame. Can you put another node on the bus to see the traffic? Are you actually sending the frame, and is you device actually responding?
Also you aren't closing your references and that can be very bad for trying to startup again. It can also cause memory leaks.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-12-2015 09:27 AM
Thanks a lot, my device must work, because i was used to use the normal CAN VIs (see below) to send and receive the frame, it worked. Now i would just translate the old code to XNET code. Is there anything wrong?
08-12-2015 09:59 AM
There's some old functions there I'm not familiar with like setting the Tranceiver type, RTR, and I've never used that wait timer function.
"Can you put another node on the bus to see the traffic? Are you actually sending the frame, and is you device actually responding?"
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-12-2015 10:05 AM
In addition to Hooovahh's suggestion, are you sure you're sending the correct Frame Type? (i.e. maybe you're sending an extended ID when you mean to be sending a standard ID.)
08-12-2015 10:11 AM
Actually i'm not sure if i really send the frame out. How can i see that?
08-12-2015 10:15 AM
@mexaviesta wrote:
Actually i'm not sure if i really send the frame out. How can i see that?
If you've got another CAN device you can attach to your bus you can just use NI-XNET Monitor.
If not, you can use NI I/O trace to make sure the I/O calls have the data you expect to see in them.
Or you can hook up a mixed signal oscilloscope which reads CAN.
08-13-2015 06:00 AM
Thanks, now i'm sure that i am not sending any frame out, because i'm using an external transeiver to connect to the CAN bus. Thus i should have configured the Interface to 'External'. So i have used the propertynode to set the transeivertype to external, but it still dosen't work. Does anyone know how to solve it? Thx