Discussion:
Getting notification of error active bus state
(too old to reply)
John Gourlay
2008-01-30 15:40:06 UTC
Permalink
Olivier,

Thanks for the ideas, but I really would like to avoid polling the interface for the bus state. 

I might have answered my own question, but I still need a little help.  I've found that if I set the
NC_ATTR_LOG_COMM_ERRS attribute to true, then I get read-available notifications and
NC_FRMTYPE_COMM_ERR frames from ncRead.  When the CAN controller goes into
error-passive state, the frame's arbitration id field contains 4003000B, "Comm. warning: No Ack".
When the CAN controller returns to error-active state, the frame's arbitration id field contains
0000000B, "Comm. errors/warnings cleared".

This is exactly what I want as far as it goes, but my remaining question is what if the CAN
controller goes into bus-off state?  I can't test this case easily.  What arbitration id value will
I get in this case?  Reading between the lines, I'm hoping that it is 8003000B, "Comm. error:
No Ack".  Is this right?

John
O_Proulx
2008-01-31 15:10:10 UTC
Permalink
Hello again John, The error code depends on what causes the device to go into bus-off state.  As mentioned above, the device goes into bus-off state when the error counter reaches 255.  The arbitration ID of the
NC_FRMTYPE_COMM_ERR frame will represent what caused the counter to go from 254 to 255.&nbsp; If it is because the device received no acknowledgement for the previous frame, then you are right, the arbitration ID will be 8003000B, "Comm. error:No Ack".You probably looked at this already, but just as reference, you can find the other error codes in this <a href="http://www.ni.com/pdf/manuals/370289k.pdf" target="_blank">manual</a> at page 11-73.&nbsp;&nbsp; Have a great day.
Loading...