Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN program using Channel API doesn't receive data

Hello everyone,

 

I'm get in stuck. I'm currently programming CAN interface for a transmission using PXI, Channel API and a .dbc file.

CAN configuration based on .dbc file is downloaded to PXI by MAX. 

 

The problem is that it receives 0 for all the values by Channel API based program (Attached file), though it seems receiving meaningful data when I check raw data by Frame API based program. 

 

Baudrate, CAN port, and .dbc file are correct.

 

thanks! 

0 Kudos
Message 1 of 3
(6,731 Views)

Hi Yuta

 

What I am expecting is that the sample rate is being set to high. When using the multiple channel - single sample instance of the CAN read vi, it will return a single sample for every period. The number of samples to read input is actually ignored and it will return a single sample for every channel specified. Therefore, if no data has been received within the sample period specified with the sample rate, it will return the default value as specified in the database file.

 

Due to the high sample rate, it might be that data is being received, but aren't visible on screen since they are quickly being overwritten by new (default) data. I suggest trying to use the Multiple Channels - Multiple Samples instance of the CAN Read vi to see if you receive values in this case. Or you could try lowering the sample speed (note that sample rate is not the same as CAN baud rate).

 

Also, make sure you are properly reading the data already in MAX's test panel as this would indicate if the database file is loaded properly.

Best Regards

Michiel
Applications Engineer
NI Belgium
http://www.ni.com/ask
0 Kudos
Message 2 of 3
(6,633 Views)

Hi Yuta

 

Did you find a solution to your CAN problem?

 

 

Best Regards

Michiel
Applications Engineer
NI Belgium
http://www.ni.com/ask
0 Kudos
Message 3 of 3
(6,560 Views)