03-17-2010 07:24 AM
I'm currently working on a soft realtime "feedforward" application in which a NI-CAN USB interface is used as a CAN frames sniffer. The idea is to read the CAN frames as fast as possible (~50Hz call to ncReadMulti) in order to apply a correction (on some power supplies) which value is computed using the motor-encoders data encapsulated into the CAN frames. This application works very well in terms of performances but I get a the NI-CAN error 0xBFF620AD something like 10 times per hour. I switched from NI-CAN 2.5.1 to 2.6.3 but it didn't solve the problem.
For the moment, I simply try to recover by resetting/restarting the CAN interface. This action usually takes about 12ms to complete - which is "acceptable" as a temporary workaround. However, I really would like to fix the problem. So my question is: what is the best NI-CAN driver configuration for such a "listen only" CAN application?
Here is my current configuration:
NCTYPE_ATTRID can_attribute_names[NUM_CAN_ATTRS];
NCTYPE_UINT32 can_attribute_values[NUM_CAN_ATTRS];
//- set baudrate -----------------------------------------
can_attribute_names[0] = NC_ATTR_BAUD_RATE;
can_attribute_values[0] = 500000;
//- start option -----------------------------------------
can_attribute_names[1] = NC_ATTR_START_ON_OPEN;
can_attribute_values[1] = NC_FALSE;
//- length of the incoming CAN frames Q -----------------
can_attribute_names[2] = NC_ATTR_READ_Q_LEN;
can_attribute_values[2] = 0;
//- no writting ------------------------------------------
can_attribute_names[3] = NC_ATTR_WRITE_Q_LEN;
can_attribute_values[3] = 0;
//--------------------------------------------------------
can_attribute_names[4] = NC_ATTR_CAN_COMP_STD;
can_attribute_values[4] = 0;
//--------------------------------------------------------
can_attribute_names[5] = NC_ATTR_CAN_MASK_STD;
can_attribute_values[5] = NC_CAN_MASK_STD_DONTCARE;
//--------------------------------------------------------
can_attribute_names[6] = NC_ATTR_CAN_COMP_XTD;
can_attribute_values[6] = 0;
//--------------------------------------------------------
can_attribute_names[7] = NC_ATTR_CAN_MASK_XTD;
can_attribute_values[7] = NC_CAN_MASK_XTD_DONTCARE;
//- listen only (no write) -------------------------------
can_attribute_names[8] = NC_ATTR_LISTEN_ONLY;
can_attribute_values[8] = NC_TRUE;
I tried to play with the <NC_ATTR_READ_Q_LEN> attribute but it doesn't seem to have any influence on my problem.
Thanks for you help.
NL
Solved! Go to Solution.
03-19-2010 05:40 PM
Hi NL,
We would to help troubleshoot the error that you are seeing. Would it be possible to give a bit more information on what function or VI throws the error and also what the error text is?
03-23-2010 03:30 AM
I finally found a solution (or at least a stable workaround).
I used to call <ncWaitForState> in order to avoid calling <ncReadMulti> while the input buffer is empty. Removing the call to <ncWaitForState> seems to fix the <0xBFF620AD> error problem. I did modification last friday and everything works smoothly (so far) on the ten of NI-CAN based systems running 7/7 - 24/24 in our accelerator control system.
NL