<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 did a test where I created three counters.<div class=""><font face="Monaco" class="">One went into</font> <font face="Monaco" class="">MCP2515_isr and counts every interrupt.</font></div><div class=""><font face="Monaco" class="">One was added as the first code line in </font><span style="font-family: Monaco;" class="">mcp2515::RxCallback.</span></div><div class=""><span style="font-family: Monaco;" class="">And the third one was added to RxCallBack, but right before we read the CAN frame via SPI that will end up in IncomingFrame. I.e. should be a count of every CAN frame. </span><span style="font-family: Monaco;" class=""> </span><div class=""><span style="font-family: Monaco;" class=""><br class=""></span></div><div class=""><span style="font-family: Monaco;" class="">This is what I got:</span></div><div class=""><span style="font-family: Monaco;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #34bc26" class="">OVMS ></span><span style="font-variant-ligatures: no-common-ligatures" class=""> can can2 status</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">CAN:       can2</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Mode:      Active</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Speed:     100000</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Rx pkt:                      82</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="font-family: Monaco;" class="">MCP2515_isr</span>:                 239</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="font-family: Monaco;" class="">RxCallback1</span>:                 320</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="font-family: Monaco;" class="">RxCallback2</span>:                 295</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Rx err:                       0</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Tx pkt:                       0</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Tx err:                       0</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Err flags: 0x2040</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div><div class=""><div>These numbers puzzles me. Shouldn’t <span style="background-color: rgb(255, 255, 255);" class=""><b class="">RxCallback1</b></span> and <span style="background-color: rgb(255, 255, 255);" class=""><b class="">RxCallback2</b></span> be less or equal to <span style="background-color: rgb(255, 255, 255);" class=""><b class="">MCP2515_isr</b></span>? Where does these extra 81 calls come from? I’m missing something here...</div><div><br class=""></div><div>Also<b class="">, RxCallback2</b> is much bigger than <b class="">Rx pkt, </b>which means not all frames are sent to IncomingFrame.<b class=""> </b>I Believe the reason is this code in can.cpp <b class="">CAN_rxtask</b><span style="font-family: Monaco;" class="">:</span></div><div><span style="font-family: Monaco;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">        <span style="color: #931a68" class="">case</span> CAN_rxcallback:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">          <u style="background-color: rgb(255, 252, 65);" class=""><span style="color: #931a68" class="">while</span> (msg.body.bus->RxCallback(&msg.body.frame))</u></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">            {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">            me->IncomingFrame(&msg.body.frame);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">            }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">          <span style="color: #931a68" class="">break</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">Is this correct? Wouldn’t it skip calling <b class="">IncomingFrame</b> it there are only one interrupt?</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">I would think this is would be more appropriate:</div><div>  </div><div> <span style="font-family: Monaco;" class="">        </span><span style="font-family: Monaco; color: rgb(147, 26, 104);" class="">case</span><span style="font-family: Monaco;" class=""> CAN_rxcallback:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">      <span class="Apple-tab-span" style="white-space:pre">    </span>  {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">          <span style="color: #931a68" class="">bool</span> keepOn=<span style="color: #931a68" class="">true</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">          <span style="color: rgb(147, 26, 104);" class="">do</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">            {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">            keepOn = msg.body.bus->RxCallback(&msg.body.frame);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">            me->IncomingFrame(&msg.body.frame);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">            }<span style="color: #931a68" class="">while</span>(keepOn);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">          }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco;" class="">          <span style="color: #931a68" class="">break</span>;</div><div class=""><br class=""></div><div class="">Do you agree?</div><div class=""><br class=""></div><div class="">But, the interrupts still stops :-( What does the 0x2040 means? And where do that number comes from? </div><div class=""><br class=""></div><div class="">Best regards,</div><div class="">Geir</div><div><br class=""></div><div><br class=""></div><div><br class=""></div><div><br class=""></div><div><blockquote type="cite" class=""><div class="">30. des. 2017 kl. 21:24 skrev Michael Balzer <<a href="mailto:dexter@expeedo.de" class="">dexter@expeedo.de</a>>:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica-Light; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class="">MCP2515 Arduino</span></div></blockquote></div><br class=""></div></div></body></html>