From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-CAN Channel API maximum sample rate

I am using the NI-CAN 2.7.2 Channel API on a PCI-CAN/2 board. If I set the output sample rate to 1000 Hz I get this error:

NI-CAN:  (Hex 0xBFF62102) A sample rate (duration) that you submitted is too large or too small.  Solution: Read the function description to determine whether to increase or decrease the sample rate.

 

I does work when set to 500 Hz.

 

I also have a GIF torque meter that sends CAN messages at 1000 Hz and I can read it with the Channel API nctRead SampleRate set to zero.

 

My question is this: What is the maximum reliable sample rate, for both input and output? I can't find that spec in the documentation.

 

Also, will the 1000 Hz input be reliable?

 

Thanks.

0 Kudos
Message 1 of 6
(6,703 Views)

The maximum output rate is 500 Hz.

 

I believe the maximum input rate depends on the particular type of hardware you're using; I think the the Series 2 supports 1 Mbit/sec data transfer, so that should be your limiting factor.

 

1000 Hz input rate should definitely be reliable, provided your software is executing fast enough to read the frames without the buffer overflowing.

0 Kudos
Message 2 of 6
(6,660 Views)

Thanks for the reply. Yes, it's only one 8-byte message. At 500 kbps it takes 24% of the bus bandwidth, so it seems it should be reliable. I was just wondering if NI-CAN has some input rate limitation. I'm checking my input buffer logic now.

0 Kudos
Message 3 of 6
(6,641 Views)

Since the sample rate is set to zero, each nctRead returns the most recent data point, so there is no buffering required.

0 Kudos
Message 4 of 6
(6,635 Views)

Revisiting this: Experiments show the output rate limit, using nctModeOutputRecent, for 6 messages is 100 Hz, for 3 messages is 200 Hz, and for 1 message is 500Hz. Reducing message length from 8 bytes does not seem to increase the limit.

 

Anyone have similar experience?

 

Is it any better under XNET with the NI-CAN Compatibility Layer?

 

0 Kudos
Message 5 of 6
(5,674 Views)

Also, if I exceed 100 Hz with 6 messages, I get this misleading error:

NI-CAN:  (Hex 0xBFF6211C) You initialized the same message with different I/O modes.  Solutions: For each message use only one I/O mode and sample rate (0 or not) combination at a time; Use a different interface (port) for each mode.

 

0 Kudos
Message 6 of 6
(5,672 Views)