<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I’m trying to recreate this with my three-can-buses-connected DB9 plugged in. Transmitting on CAN1 should make it appear on CAN2 and CAN3.<div class=""><br class=""></div><div class="">Here is what I see:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# can can1 start active 1000000</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Can bus can1 started in mode active at speed 1000000bps</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# can can2 start active 1000000</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Can bus can2 started in mode active at speed 1000000bps</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# test cantx can1 25000</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Testing 25000 frames on can1</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Transmitted 25000 frames in 6.466209s = 258us/frame</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# can can1 status</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">CAN: can1</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Mode: Active</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Speed: 1000000</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Interrupts: 24771</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx pkt: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx err: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx ovrflw: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx pkt: 24880</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx delays: 24703</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx err: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx ovrflw: 109</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Err flags: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# can can2 status</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">CAN: can2</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Mode: Active</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Speed: 1000000</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Interrupts: 19084</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx pkt: 24770</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx err: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx ovrflw: 1</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx pkt: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx delays: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx err: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx ovrflw: 0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Err flags: 0x2040</span></font></div></div></blockquote><div class=""><div><br class=""></div><div>Note the err flags 0x2040 on CAN2, but the bus remains up and working fine.</div><div><br class=""></div><div>Repeating the test gives us:</div><div><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# test cantx can1 25000</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Testing 25000 frames on can1</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Transmitted 25000 frames in 6.479670s = 259us/frame</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# can can1 status</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">CAN: can1</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Mode: Active</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Speed: 1000000</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Interrupts: 49546</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx pkt: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx err: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx ovrflw: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx pkt: 49771</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx delays: 49417</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx err: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx ovrflw: 207</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Err flags: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# can can2 status</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">CAN: can2</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Mode: Active</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Speed: 1000000</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Interrupts: 38288</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx pkt: 49545</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx err: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Rx ovrflw: 3</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx pkt: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx delays: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx err: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Tx ovrflw: 0</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Err flags: 0x2040</span></font></div></div></div></blockquote><div class=""><div><br class=""></div><div>Looking at the mcp2515 code, it seems that Err flags are only stored "if (intstat & 0b10100000)”. That is "ERRF 0x80 = message tx/rx error” or "ERRIF 0x20 = overflow / error state change”. It is also set to "(intstat & 0b10100000) << 8 | errflag”, so doesn’t show all the error statuses. It is hard to rely on that for other errors/status on lock-up. Given that error_flags is a uint32_t, I think we can store more in it to allow for better diagnosis.</div><div><br class=""></div><div>I changed the mcp2515 driver to always set error_flags, on each interrupt handled (except spurious interrupts with no flags found), as follows:</div><div><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">SSSSSSSSFFFFFFFF***EB01TLLLLLLLL</span></font></div><div><ul class="MailOutline"><li class=""><span style="font-family: "Andale Mono"; font-size: 14px;" class="">SSSSSSSS = intstat</span></li><li class=""><span style="font-size: 14px; font-family: "Andale Mono";" class="">FFFFFFFF = errflag</span></li><li class=""><span style="font-size: 14px; font-family: "Andale Mono";" class="">B = RXB0 or RXB1 overflow flags cleared</span></li><li class=""><span style="font-size: 14px; font-family: "Andale Mono";" class="">0 = RXB0 overflowed</span></li><li class=""><span style="font-size: 14px; font-family: "Andale Mono";" class="">1 = RXB1 overflowed</span></li><li class=""><span style="font-size: 14px; font-family: "Andale Mono";" class="">T = TX buffer has become available</span></li><li class=""><span style="font-size: 14px; font-family: "Andale Mono";" class="">E = Error/WakeUp flags were cleared</span></li><li class=""><span style="font-size: 14px; font-family: "Andale Mono";" class="">LLLLLLLL = intflag</span></li></ul></div></div></blockquote><div class=""><div><br class=""></div><div>I did find a problem on line 300: if (intstat & 0b10100000). It think that should be 0b11100000 (to also pickup the RXB0 overflow), and removed the m_status.rxbuf_overflow++ from RXB0 overflow (as it is not really an overflow - as RXB1 got the data).</div><div><br class=""></div><div>With those changes made, I get:</div><div><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# test cantx can1 25000<br class="">Testing 25000 frames on can1<br class="">Transmitted 25000 frames in 6.389849s = 255us/frame</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class="">OVMS# can can1 status<br class="">CAN: can1<br class="">Mode: Active<br class="">Speed: 1000000<br class="">Interrupts: 24777<br class="">Rx pkt: 0<br class="">Rx err: 0<br class="">Rx ovrflw: 0<br class="">Tx pkt: 24884<br class="">Tx delays: 24739<br class="">Tx err: 0<br class="">Tx ovrflw: 116<br class="">Err flags: 0x00000000</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class="">OVMS# can can2 status<br class="">CAN: can2<br class="">Mode: Active<br class="">Speed: 1000000<br class="">Interrupts: 18935<br class="">Rx pkt: 24777<br class="">Rx err: 0<br class="">Rx ovrflw: 0<br class="">Tx pkt: 0<br class="">Tx delays: 0<br class="">Tx err: 0<br class="">Tx ovrflw: 0<br class="">Err flags: 0x01000001</span></font></div></div></div></blockquote><div class=""><div><br class=""></div><div>I don’t think I’ve fixed anything (apart from that minor issue with RXB0 overflow diagnostics), but hopefully the new error_flags display should help finding out what is causing this lockup. Hopefully I haven’t broken anything.</div><div><br class=""></div><div>Regards, Mark.</div><div><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On 7 Jul 2018, at 10:42 AM, Tom Parker <<a href="mailto:tom@carrott.org" class="">tom@carrott.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 07/07/18 00:05, Mark Webb-Johnson wrote:<br class=""><blockquote type="cite" class="">Err flags 0x2040. The 0x20 part is the error interrupt. The 0x40 part is "RX0OVR: Receive Buffer 0 Overflow Flag bit”.<br class=""><br class="">Where the number on ‘can can2 status’ moving at all? Or completely stuck?<br class=""></blockquote><br class="">None of the can can2 status numbers change when the can bus is broken. After power cycling it they move.<br class=""><br class=""><blockquote type="cite" class="">Seems different than the fault Greg and I are seeing. This one likely to be interrupt flag, or buffer overflow, not being cleared correctly. I’m guessing the overflow because that just doesn’t seem correct in mcp2515::RxCallback(). I’ll focus on that and have a look.<br class=""></blockquote><br class="">I just checked the car again and it stopped with Rx ovrflw number only 1281, half what it got to last time.<br class=""><br class="">_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.openvehicles.com" class="">OvmsDev@lists.openvehicles.com</a><br class="">http://lists.openvehicles.com/mailman/listinfo/ovmsdev<br class=""></div></div></blockquote></div><br class=""></div></body></html>