LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-XNET CAN frame properties timing type

Solved!
Go to solution

Hi all,

I have an issue with CAN timing. I am attemping to read / write CAN bus every 10ms. I am using timed loops to do this and i usually see 9ms / 10ms loop itteration intervals which is fine. However, sometimes my CAN comms drops out completely and the loop can take 5 seconds to exectue once. The cpu work rate (from task manager) doesn't look too badly loaded (<30%).

 

I notice in the database editor for NI-XNET i have the choice of timing type. I am currently using event data, but wondered if there was something i could do to use some kind of hardware timing for my CAN transmissions? Oddly for NI the help seems pretty limited for the timing type (hence my post here). Any help on what the timing type options mean, and if any are likely to firm up my 10ms loop time, and (hopefully) prevent my CAN bus lock up isues would be really apprciated.

Many thanks.

0 Kudos
Message 1 of 9
(4,483 Views)
Are you running on Windows or on RT? If you're on RT, then I think a timed loop for event data may work ok. If you're on Windows, you're definitely going to want to use HW timing and the one of the Queued session modes with Cyclic Data. The XNET Help file is pretty good about explaining the differences between Streaming and Queued sessions. If you have any specific questions or example code you want looked at, let us know.
0 Kudos
Message 2 of 9
(4,480 Views)

Thank you for the reply.

The help is comprehensive (as expected) - for some reason i just couldn't find it yesterday.

All ok, except for the hardware timing, - how do i specify in my program that i want to make use of hardware timing?

Many thanks.

0 Kudos
Message 3 of 9
(4,473 Views)

If you use the Queued session and Cyclic Data, the transmissions will be HW timed based on the period specified for your Cyclic Data.

 

I work mostly with Frame data.

 

What type of session are you using now?

0 Kudos
Message 4 of 9
(4,467 Views)

Hello, - Thank you so much for the assistance.

I am using 'Frame in single point' for my reads, and 'Frame out single point' for my writes.

I have selected cyclic timing type with a time period for transmission of 10ms in my NI-XNET database. It seems to be better now, - i have not seen 1 instance of my can loop locking up. I still have my timed loop at 10ms containing my NI-XNET write VI.

I am not using a queued session, - as i understand, the queue will hold the frames and they will be released in order at 10ms intervals? With the single point & cyclic timing as i understand unless a new frame is written then the same frame will be released every 10ms. - This suits my needs for now. 

With cyclic timing type and Frame in single point, - are my CAN transmissions now hardware timed? - they do seem more regular now, and i have not witnessed any instances of the CAN loop locking up.

Thanks again for your help.

 

0 Kudos
Message 5 of 9
(4,465 Views)
Solution
Accepted by topic author georgeofthejungle

@georgeofthejungle wrote:

I am using 'Frame in single point' for my reads, and 'Frame out single point' for my writes.

I have selected cyclic timing type with a time period for transmission of 10ms in my NI-XNET database. It seems to be better now, - i have not seen 1 instance of my can loop locking up. I still have my timed loop at 10ms containing my NI-XNET write VI.

I am not using a queued session, - as i understand, the queue will hold the frames and they will be released in order at 10ms intervals? With the single point & cyclic timing as i understand unless a new frame is written then the same frame will be released every 10ms. - This suits my needs for now. 

After reading the help, single point seems like it will work sufficiently for you.  Do keep in mind that if you end up writing twice before the next 10 ms transmission, you could miss a signal update.  This could happen if your software update of 10ms doesn't quite match the hardware transmission's 10 ms.

With cyclic timing type and Frame in single point, - are my CAN transmissions now hardware timed? - they do seem more regular now, and i have not witnessed any instances of the CAN loop locking up.

The Cyclic timing will force HW timed transmissions from the CAN controller so yes, you are now HW timed for transmission. 

Thanks again for your help.

 


Glad your CAN bus seems to be much happier now.  Feel free to post if you run into anything else.

0 Kudos
Message 6 of 9
(4,459 Views)

great help. Thank you.

0 Kudos
Message 7 of 9
(4,456 Views)

Hi,

I am really happy that I can read this article because it seems like it is the similar problem that I am facing right now. I also has a really bad CAN update delay when I want to write Data on CAN bus.  I was trying to following your solusion here, use frame in single point, frame out single point. But I am not so sure that I can continue. In our labview, we use frame in/out stream(sorry the screenshot cut is wrong). But if I want to change it to frame in/out single point, it will show an error saying: mising wiring on NI-XNET block.

 

In our labview, we use a big sequence loop. So what in saw in the 1st pic I attached is the first sequence, then in the 2nd sequence we had a Frame Can write frame. Then in the 3rd one, which is in the 2nd pic, it shows the CAN write frame that contain a lot of message that I would like to write on CAN bus.

 

The problem here is sometimes the CAN loop takes 0.3s(I use a shift register in the 3rd sequence showing CAN loop time) to update which is too low for me to use Vector Canalyzer to record data. 

 

In your article it said I need to 'Frame in single point' for my reads, and 'Frame out single point' for my writes. I do not know where I can do this. Also how to make it cycling timing. And I did not have any database in NI-XNET database editor. Do I need to build it there?

 

 

Thank you so much. can in.pngcan write.png

0 Kudos
Message 8 of 9
(4,113 Views)

You might want to start a new thread and link to this one.

Since this one was already marked as solved, a lot of people won't come back to read it.

If you're able, I would suggest posting your VI.

 

I would guess that something in your "big sequence loop" is the more likely culprit for your CAN transmission delay.


@SandyGao wrote:

Hi,

I am really happy that I can read this article because it seems like it is the similar problem that I am facing right now. I also has a really bad CAN update delay when I want to write Data on CAN bus.  I was trying to following your solusion here, use frame in single point, frame out single point. But I am not so sure that I can continue. In our labview, we use frame in/out stream(sorry the screenshot cut is wrong). But if I want to change it to frame in/out single point, it will show an error saying: mising wiring on NI-XNET block.

 

In our labview, we use a big sequence loop. So what in saw in the 1st pic I attached is the first sequence, then in the 2nd sequence we had a Frame Can write frame. Then in the 3rd one, which is in the 2nd pic, it shows the CAN write frame that contain a lot of message that I would like to write on CAN bus.

 

The problem here is sometimes the CAN loop takes 0.3s(I use a shift register in the 3rd sequence showing CAN loop time) to update which is too low for me to use Vector Canalyzer to record data. 

 

In your article it said I need to 'Frame in single point' for my reads, and 'Frame out single point' for my writes. I do not know where I can do this. Also how to make it cycling timing. And I did not have any database in NI-XNET database editor. Do I need to build it there?

 

 

Thank you so much. 


 

0 Kudos
Message 9 of 9
(4,108 Views)