<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
The CAN status variables are all explained in can.h:<br>
<br>
<font face="monospace">// CAN status<br>
typedef struct<br>
{<br>
uint32_t interrupts; // interrupts<br>
uint32_t packets_rx; // frames reveiced<br>
uint32_t packets_tx; // frames sent successfully<br>
uint32_t txbuf_delay; // frames routed through TX
queue<br>
uint16_t rxbuf_overflow; // frames lost due to RX
buffers full<br>
uint16_t txbuf_overflow; // TX queue overflows<br>
uint32_t tx_fails; // TX failures/aborts<br>
uint32_t error_flags; // driver specific bitset<br>
uint16_t errors_rx; // RX error counter<br>
uint16_t errors_tx; // TX error counter<br>
uint16_t invalid_rx; // RX invalid frame counter<br>
uint16_t watchdog_resets; // Watchdog reset counter<br>
uint16_t error_resets; // Error resolving reset
counter<br>
uint32_t error_time; // monotonictime of last error
state detection<br>
} CAN_status_t;<br>
<br>
</font><br>
The driver specific error flags need to be decoded in the context of
the transceiver type: can1 = esp32can driver, losely SJA1000
compatible, can2 & can3 = mcp2515 driver.<br>
<br>
esp32can:<br>
<font face="monospace"> error_flags = error_irqs << 16 |
(status & 0b11001110) << 8 | (ecc & 0xff);</font><br>
<br>
esp32can error & status bits are documented in
"esp32can_regdef.h", see SJA1000 documentation for more details.<br>
<br>
mcp2515:<br>
<font face="monospace"> error_flags = (intstat << 24) |
(errflag << 16) | intflag;</font><br>
<br>
mcp2515 interrupt & error bits are documtented in
"mcp2515_regdef.h", see MCP2515 documentation for more details, plus
some synthetic internal debugging flags as ORed in by the driver in
`mcp2515::AsynchronousInterruptHandler()` beginning on line 500.<br>
<br>
<blockquote type="cite">
<p>Interestingly both of us saw can2 errors in pairs: one with
errflags=0x23401c01 and one with 0x22401c02. In my case these
were either 0 or 10 ms apart.</p>
</blockquote>
<ul>
<li>intstat 0x23 = 0b00100011 = Error state change (details in
EFLG) | RX buffer 1 full | RX buffer 0 full</li>
<ul>
<li>… 0x22 = same, but only RX buffer 1 full (RXB0 has just been
cleared by the driver)<br>
</li>
</ul>
<li>errflag 0x40 = 0x01000000 = Receive Buffer 0 Overflow</li>
<li>intflag 0x1c01 = all indications detected & processed at
RX buffer 0</li>
<ul>
<li>… 0x1c02 = same, but at RX buffer 1<br>
</li>
</ul>
</ul>
So these are simply indications of RX buffer 0 overflows. These are
no "real" overflows, as RX buffer 1 was still available, so the
frames were not lost and the <font face="monospace">rxbuf_overflow</font>
counter was not incremented.<br>
<br>
The driver could clear this condition to avoid signaling this as a
CAN error. I think we kept it that way because an RXB0 overflow
already indicates a lot of traffic on the bus. This could also
result in a warning log, but the CAN framework doesn't know how to
distinguish driver specific errors from warnings.<br>
<br>
<div>
<blockquote type="cite">
<div>Err flags: 0x01000001</div>
</blockquote>
<ul>
<li>…simply means RXB0 has been received & read.<br>
</li>
</ul>
</div>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 23.01.25 um 14:48 schrieb Chris Box
via OvmsDev:<br>
</div>
<blockquote type="cite"
cite="mid:010b0194936bc595-14ed2bb9-1031-4998-931a-b932abd03d83-000000@eu-west-2.amazonses.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div
style="font-size: 10pt; font-family: Verdana,Geneva,sans-serif;">
<p id="v1reply-intro">On 2025-01-23 12:11, Developer From Jokela
via OvmsDev wrote:</p>
<blockquote type="cite"
style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="v1replybody1"
style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div>
<div>E (445282) can: can2: intr=240803 rxpkt=242887
txpkt=6 errflags=0x22401c02 rxerr=0 txerr=0 rxinval=0
rxovr=0 txovr=0 txdelay=0 txfail=0 wdgreset=0 errreset=0</div>
<div> </div>
</div>
</div>
</blockquote>
<div id="v1replybody1"
style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div>
<div> </div>
<p>Ok, now putting Developer From Jokela's post together
with Michael's I <span
style="text-decoration: underline;">think</span> I
understand what this is telling us.</p>
<p>First, E means error.</p>
<p>The presence of this line in the log means there has been
an error on can bus 2. The values given appear to be the
current values of some counters.</p>
<p>The code is in can/src/can.cpp. This has basic
deduplication by summing most of the counters and
errflags, and only logging if this changes. Interestingly
both of us saw can2 errors in pairs: one with
errflags=0x23401c01 and one with 0x22401c02. In my case
these were either 0 or 10 ms apart.</p>
<p>The flags appear to derive from mcp2515/src/mcp2515.cpp
but it's not clear to me what they mean.</p>
<div> </div>
</div>
</div>
<blockquote type="cite"
style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="v1replybody1"
style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div>
<div>OVMS# can can2 status</div>
<div>CAN: can2</div>
<div>Mode: Active</div>
<div>Speed: 500000</div>
<div>DBC: none</div>
<div> </div>
<div>Interrupts: 291197</div>
<div>Rx pkt: 293642</div>
<div>Rx ovrflw: 0</div>
<div>Tx pkt: 6</div>
<div>Tx delays: 0</div>
<div>Tx ovrflw: 0</div>
<div>Tx fails: 0</div>
<div> </div>
<div>Err flags: 0x01000001</div>
<div>Rx err: 0</div>
<div>Tx err: 0</div>
<div>Rx invalid: 0</div>
<div>Wdg Resets: 0</div>
<div>Wdg Timer: 9 sec(s)</div>
<div>Err Resets: 0</div>
</div>
<div> </div>
</div>
</blockquote>
<div id="v1replybody1"
style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div> </div>
<div>Question: If the log tells us that can2 errors have
occurred, why does "can can2 status" report zero values for
errors?</div>
</div>
<p>Chris</p>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre wrap="" class="moz-quote-pre">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Michael Balzer * Am Rahmen 5 * D-58313 Herdecke
Fon 02330 9104094 * Handy 0176 20698926</pre>
</body>
</html>