04-07-2009 04:47 AM
Greetings,
I have a CAN Object set to communication mode NC_CAN_COMM_RX_UNSOL, looking at a specific arbitration ID. The object is configured to receive changes only by setting NC_ATTR_RX_CHANGES_ONLY to true. The object’s read buffer size is set to 10.
The device sending the frames with the ID in question, does so every 100ms, in response to frames I send. If I send nothing, the device will repeat the last acknowledgement every 100ms.
I’m finding that, my read buffer overflows in approx 1 sec, or 100ms * 10. If I read the buffer dry it fills right back up again. All the data from the frames appears to be identical. What might I be doing wrong?
The buffer overflow message I get is 0xBFF62028, which is an overflow in the lower level read queue.
I’m running a Series 1 card with NI-CAN 2.6.1
Any insight would be greatly appreciated.
Thanks.
Below is my configuration code for the acknowledgement frames…
//Configure and open a CAN Object to receive acknowledgements and data
try
{
//Set CAN Object name for the EOL response message arbitration ID
NCTYPE_STRING CANObjName = "CAN0::STD0x551";
//Set the CAN Object attributes
NCTYPE_ATTRID AttrIdList[6] = {NC_ATTR_PERIOD, NC_ATTR_READ_Q_LEN, NC_ATTR_WRITE_Q_LEN, NC_ATTR_COMM_TYPE, NC_ATTR_DATA_LEN, NC_ATTR_RX_CHANGES_ONLY};
NCTYPE_UINT32 AttrValList[6] = {0, 10, 0, NC_CAN_COMM_RX_UNSOL, 8, NC_TRUE};
//Configure the CAN Object
Status = ncConfig(CANObjName, 5, AttrIdList, AttrValList);
if (Status == 0)
{
//Open the CAN hardware and obtain a handle
Status = ncOpenObject(CANObjName, &CANResponseObj);
if (Status != 0)
{
//Capture the warning or error string
ncStatusToString(Status, sizeof(StatusStr), StatusStr);
ShowMessage("CAN Response Object ncOpen: " + String(StatusStr));
exit(Status);
}
}
else
{
//Capture the warning or error string
ncStatusToString(Status, sizeof(StatusStr), StatusStr);
ShowMessage("CAN Response Object ncConfig: " + String(StatusStr));
exit(Status);
}
}
catch(...)
{
}
Solved! Go to Solution.
04-07-2009 04:32 PM - edited 04-07-2009 04:33 PM
I found my error, a stupid mistake actually. When I added NC_ATTR_RX_CHANGES_ONLY to the attribute array, I neglected to update the call to ncConfig with the extra array element.
I updated the call to ncConfig to receive all 6 attribute elements and it works as expected.
Funny how you can look at code and see what you want to see.
Andy