Skip to content

Commit bcee891

Browse files
nattgrishefloryd
authored andcommitted
Only trigger the Error behaviour on the mandatory events
The automatic NMT transition to Pre-operational, or any other action that has been configured in 1029h, is only required to happen on Bus- off or Life guarding/Heartbeat time-out. Currently, all EMCYs that are sent do trigger the error behaviour, even if the error is not a "serious CANopen device failure". It even reverts back to pre-operational when an error is cleared and EMCY 0x0000 is sent. Turn off the error behaviour except for EMCY codes 0x8130 and 0x8140 which correspond to the mandatory events (although the Bus-off EMCY actually means *recovery* from Bus-off, so the Error behavior will happen much later than was probably intended). Ref: #39 Change-Id: I09cc847f6dc2bcc2e32411625c33d7fe2dce2368
1 parent 6735cc1 commit bcee891

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/co_emcy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ int co_emcy_tx (co_net_t * net, uint16_t code, uint16_t info, uint8_t msef[5])
257257
net->cb_emcy (net->cb_arg, net->node, code, reg, msef);
258258
}
259259

260+
if (code != 0x8140 && code != 0x8130) {
261+
return 0;
262+
}
263+
260264
/* Transition state according to error behavior setting */
261265
switch (net->error_behavior)
262266
{

0 commit comments

Comments
 (0)