<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Tom,<br>
    <br>
    My suspicion is that it's the opening of the CAN port where the
    problem is.  I tried putting delays in the OBD2ECU code to cause a
    receive overrun, and things recovered just fine when the delay
    cleared.  Writes to the CAN bus are generally once per read (request
    and response sequence), but there are a few places where the task
    can issue multiple writes to the bus back-to-back.  Some time ago,
    two writes were fine, but three (I think) would cause a transmit
    overflow.  Michael and I fixed that, so even if you're sending
    multiple frames it should be fine.  Basically, once the bus is open
    and running, it seems to work pretty well.  It's just that 'open'
    procedure that seems to have a problem when the bus is already
    active.<br>
    <br>
    Note that the only way I have found to clear the hung bus condition
    is to stop the traffic, close the port, open the port, and resume
    the traffic.<br>
    <br>
    I haven't looked at the Leaf code, but I suspect that the climate
    commands open the CAN bus, write the necessary frames, and then
    close it afterward.  If so, that would definitely risk the issue I'm
    seeing.  If there's a way to open the environmental bus at boot time
    and leave it open, that should workaround the problem, assuming of
    course that you survive the initial open.  I can control the
    external device with ext12v power; you can't control the Leaf
    environmental bus...<br>
    <br>
    Greg<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Tom Parker wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:25c75c25-b5db-ace9-3bdf-9c8a5c480ac4@carrott.org">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <p>On the 2016 Leaf the Climate Control command is sent on the
        'CAR' CAN bus which is connected to on of the exernal can
        busses. I'm not sure if there is a task, or if there are other
        usages of the CAN2 bus in the Leaf implementation (there weren't
        last time I looked closely but I haven't been able to keep up
        with the improvements others have made). The Climate Control
        does do task or timer related stuff because it sends the CAN
        message several times over a period of a second or two.<br>
      </p>
      <p>This is distinct from the earlier Leafs where climate control
        is on the EV can bus connected to the internal CAN bus.<br>
      </p>
      <div class="moz-cite-prefix">On 29/05/19 2:57 PM, Greg D. wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:47e335be-220d-9853-7cb9-9306b822e369@gmail.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=windows-1252">
        Hi Stein,<br>
        <br>
        Interesting.  Does the "start climate control" command start a
        new process/task on OVMS, or otherwise cause the CAN2 bus to be
        "opened" at the time of the command?  If so, that would be
        consistent with what I see. <br>
        <br>
        With the OBD2ECU translator, if I have an OBDII device (e.g.
        head-up display) running first, and then start the OBD2ECU task,
        the bus will hang every time.  If I start the task first, then
        power up the OBDII device, all will be fine.  There seems to be
        a collision between the task starting and the data coming in
        that triggers the bus hang.<br>
        <br>
        I have a pair of scripts to turn on and turn off the Ext12v
        supply to the OBDII device when the car is turned on or off,
        respectively.  That's just to manage the OBDII device as if it
        were in an ICE vehicle.  What I do now, as a workaround for the
        bus hang, is to stop and restart the OBD2ECU task before turning
        on the ext12v supply in the car turn-on script.  That seems to
        work.<br>
        <br>
        Not sure how that might help your problem (since you can't turn
        off the car's data stream), but at least it would confirm that
        we're looking at the same bug.  <br>
        <br>
        Greg<br>
        <br>
        <br>
        <div class="moz-cite-prefix">ovms wrote:<br>
        </div>
        <blockquote type="cite"
          cite="mid:2ed9270d-368d-4798-aabc-8510ee5aa911@DISKSTATION2">
          <div>I just discovered something. Since the temperature has
            been pretty stable the last month (not cold, and not warm) I
            have not used the climate control function in OVMS.</div>
          <div>With the latest firmware, CAN2 can recieve data for many
            days, until I trigger the "start climate control" command.
            Then CAN2 stops receiving. (and "possible theft" message
            occurs). Car is 2016 Leaf. </div>
          <div> </div>
          <div>Kind regards,</div>
          <div>Stein Arne Sordal</div>
          <div class="syno-mc-signature"> </div>
          <div> </div>
          <div class="">
            <div>On 2019-04-01 14:56, Mark Webb-Johnson <a
                class="moz-txt-link-rfc2396E"
                href="mailto:mark@webb-johnson.net"
                moz-do-not-send="true"><mark@webb-johnson.net></a>
              wrote:</div>
            <blockquote class="syno-mc-blockquote" style="padding-left:
              5px; margin-left: 5px; border-left: #c8d2dc 2px solid;">So
              this is with CAN2 not working?
              <div class=""> </div>
              <div class="">Err flags are 0x80001080. For MCP2515 that
                is:</div>
              <div class=""> </div>
              <div class="">
                <ul class="MailOutline">
                  <li class="">(intstat << 24) |</li>
                  <li class="">(errflag << 16) |</li>
                  <li class="">intflag</li>
                </ul>
              </div>
              <div class=""> </div>
              <div class="">So intstat = 0x80, errflag = 0x00, intflag =
                0x1080.</div>
              <div class=""> </div>
              <div class="">The 0x10.. in intflag indicates that this
                just ran:</div>
              <div class=""> </div>
              <blockquote class="" style="margin: 0 0 0 40px; border:
                none; padding: 0px;">
                <div class="">
                  <div class=""><span style="font-family: 'Andale
                      Mono';"><span class="" style="font-size: 14px;"> 
                        // clear error & wakeup interrupts:</span></span></div>
                  <div class=""><span style="font-family: 'Andale
                      Mono';"><span class="" style="font-size: 14px;"> 
                        if (intstat & 0b11100000)</span></span></div>
                  <div class=""><span style="font-family: 'Andale
                      Mono';"><span class="" style="font-size: 14px;"> 
                          {</span></span></div>
                  <div class=""><span style="font-family: 'Andale
                      Mono';"><span class="" style="font-size: 14px;"> 
                          m_status.error_flags |= 0x1000;</span></span></div>
                  <div class=""><span style="font-family: 'Andale
                      Mono';"><span class="" style="font-size: 14px;"> 
                          m_spibus->spi_cmd(m_spi, buf, 0, 4,
                        CMD_BITMODIFY, 0x2c, intstat & 0b11100000,
                        0x00);</span></span></div>
                  <div class=""><span style="font-family: 'Andale
                      Mono';"><span class="" style="font-size: 14px;"> 
                          }</span></span></div>
                </div>
              </blockquote>
              <div class="">
                <div> </div>
                <div>The instat=0x80 indicates "MERRF: Message Error
                  Interrupt Flag bit”. So that is a bus error, but the
                  errflag=0x00 so there are no indicated issues with
                  either the 96 or 128 successive errors hit. The
                  documentation (mcp2515 spec sheet) for this says:</div>
                <div> </div>
              </div>
              <blockquote class="" style="margin: 0 0 0 40px; border:
                none; padding: 0px;">
                <div class="">
                  <div>7.4 Message Error Interrupt<br class="">
                    <br class="">
                    When an error occurs during the transmission
                    or reception of a message, the message error
                    flag (CANINTF.MERRF) will be set and, if
                    the CANINTE.MERRE bit is set, an interrupt will be
                    gener- ated on the INT pin. This is intended to be
                    used to facilitate baud rate determination when used
                    in conjunction with Listen-only mode.</div>
                </div>
              </blockquote>
              <div class="">
                <div> </div>
                <div>I can’t see anything obviously wrong with that. Not
                  sure how to proceed. Perhaps we need a command to dump
                  all the MCP2515 registers? We could at least then see
                  the current state of the chip with all the gory
                  details.</div>
                <div> </div>
                <div>Regards, Mark.</div>
                <div> </div>
                <div>
                  <blockquote class="">
                    <div class="">On 1 Apr 2019, at 3:49 PM, ovms <<a
                        href="mailto:ovms@topphemmelig.no"
                        target="_blank" rel="noopener noreferrer"
                        moz-do-not-send="true">ovms@topphemmelig.no</a>>
                      wrote:</div>
                    <br class="Apple-interchange-newline">
                    <div class="">
                      <div class="">Looks the same, see attachment.</div>
                      <div class=""> </div>
                      <div class="">-Stein Arne-</div>
                      <div class=""> </div>
                      <div class="syno-mc-signature"> </div>
                      <div class=""> </div>
                      <div class="">
                        <div class="">On 2019-04-01 09:38, Mark
                          Webb-Johnson <<a
                            href="mailto:mark@webb-johnson.net"
                            target="_blank" rel="noopener noreferrer"
                            moz-do-not-send="true">mark@webb-johnson.net</a>>
                          wrote:</div>
                        <div>
                          <blockquote class="syno-mc-blockquote"
                            style="padding-left: 5px; margin-left: 5px;
                            border-left: #c8d2dc 2px solid;">This is the
                            thread from last summer talking about CAN
                            bus lock-ups.
                            <div class=""> </div>
                            <div class="">I’m guessing this is still
                              happening for Leaf? Since the changes made
                              below (back then), I haven’t seen it in my
                              car.</div>
                            <div class=""> </div>
                            <div class="">Next time this happens to you
                              guys (can2 stopped), can you get a ‘can
                              can2 status’, wait 30 seconds, and repeat.
                              Then send it here for us to look at.</div>
                            <div class=""> </div>
                            <div class="">Regards, Mark.<br class="">
                              <div class=""><br class="">
                                <blockquote class="">
                                  <div class="">On 7 Jul 2018, at 10:37
                                    PM, Mark Webb-Johnson <<a
                                      href="mailto:mark@webb-johnson.net"
                                      target="_blank" rel="noopener
                                      noreferrer" moz-do-not-send="true">mark@webb-johnson.net</a>>
                                    wrote:</div>
                                  <br class="Apple-interchange-newline">
                                  <div class="">
                                    <div class="" style="word-wrap:
                                      break-word; -webkit-nbsp-mode:
                                      space; line-break:
                                      after-white-space;">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=""> </div>
                                      <div class="">Here is what I see:</div>
                                      <div class=""> </div>
                                      <blockquote class=""
                                        style="margin: 0 0 0 40px;
                                        border: none; padding: 0px;">
                                        <div class="">
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">OVMS#
                                                can can1 start active
                                                1000000</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Can
                                                bus can1 started in mode
                                                active at speed
                                                1000000bps</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">OVMS#
                                                can can2 start active
                                                1000000</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Can
                                                bus can2 started in mode
                                                active at speed
                                                1000000bps</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">OVMS#
                                                test cantx can1 25000</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Testing
                                                25000 frames on can1</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Transmitted
                                                25000 frames in
                                                6.466209s = 258us/frame</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;"> </span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">OVMS#
                                                can can1 status</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">CAN:
                                                      can1</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Mode:
                                                     Active</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Speed:
                                                    1000000</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Interrupts:
                                                              24771</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Rx
                                                pkt:                    
                                                  0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Rx
                                                err:                    
                                                  0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Rx
                                                ovrflw:                
                                                   0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Tx
                                                pkt:                  
                                                24880</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Tx
                                                delays:              
                                                 24703</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Tx
                                                err:                    
                                                  0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Tx
                                                ovrflw:                
                                                 109</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Err
                                                flags: 0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">OVMS#
                                                can can2 status</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;"> </span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">CAN:
                                                      can2</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Mode:
                                                     Active</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Speed:
                                                    1000000</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Interrupts:
                                                              19084</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Rx
                                                pkt:                  
                                                24770</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Rx
                                                err:                    
                                                  0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Rx
                                                ovrflw:                
                                                   1</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Tx
                                                pkt:                    
                                                  0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Tx
                                                delays:                
                                                   0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Tx
                                                err:                    
                                                  0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Tx
                                                ovrflw:                
                                                   0</span></span></div>
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">Err
                                                flags: 0x2040</span></span></div>
                                        </div>
                                      </blockquote>
                                      <div class="">
                                        <div class=""> </div>
                                        <div class="">Note the err flags
                                          0x2040 on CAN2, but the bus
                                          remains up and working fine.</div>
                                        <div class=""> </div>
                                        <div class="">Repeating the test
                                          gives us:</div>
                                        <div class=""> </div>
                                      </div>
                                      <blockquote class=""
                                        style="margin: 0 0 0 40px;
                                        border: none; padding: 0px;">
                                        <div class="">
                                          <div class="">
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">OVMS# test
                                                  cantx can1 25000</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Testing 25000
                                                  frames on can1</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Transmitted
                                                  25000 frames in
                                                  6.479670s =
                                                  259us/frame</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;"> </span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">OVMS# can can1
                                                  status</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">CAN:       can1</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Mode:    
                                                   Active</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Speed:    
                                                  1000000</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Interrupts:    
                                                            49546</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Rx pkt:        
                                                                0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Rx err:        
                                                                0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Rx ovrflw:    
                                                                 0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Tx pkt:        
                                                            49771</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Tx delays:    
                                                             49417</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Tx err:        
                                                                0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Tx ovrflw:    
                                                               207</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Err flags: 0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;"> </span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">OVMS# can can2
                                                  status</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">CAN:       can2</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Mode:    
                                                   Active</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Speed:    
                                                  1000000</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Interrupts:    
                                                            38288</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Rx pkt:        
                                                            49545</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Rx err:        
                                                                0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Rx ovrflw:    
                                                                 3</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Tx pkt:        
                                                                0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Tx delays:    
                                                                 0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Tx err:        
                                                                0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Tx ovrflw:    
                                                                 0</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">Err flags:
                                                  0x2040</span></span></div>
                                          </div>
                                        </div>
                                      </blockquote>
                                      <div class="">
                                        <div class=""> </div>
                                        <div class="">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 class=""> </div>
                                        <div class="">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 class=""> </div>
                                      </div>
                                      <blockquote class=""
                                        style="margin: 0 0 0 40px;
                                        border: none; padding: 0px;">
                                        <div class="">
                                          <div class=""><span class=""
                                              style="font-family:
                                              'Andale Mono';"><span
                                                class=""
                                                style="font-size: 14px;">SSSSSSSSFFFFFFFF***EB01TLLLLLLLL</span></span></div>
                                          <div class="">
                                            <ul class="MailOutline">
                                              <li class=""><span
                                                  class=""
                                                  style="font-family:
                                                  'Andale Mono';
                                                  font-size: 14px;">SSSSSSSS
                                                  = intstat</span></li>
                                              <li class=""><span
                                                  class=""
                                                  style="font-size:
                                                  14px; font-family:
                                                  'Andale Mono';">FFFFFFFF
                                                  = errflag</span></li>
                                              <li class=""><span
                                                  class=""
                                                  style="font-size:
                                                  14px; font-family:
                                                  'Andale Mono';">B =
                                                  RXB0 or RXB1 overflow
                                                  flags cleared</span></li>
                                              <li class=""><span
                                                  class=""
                                                  style="font-size:
                                                  14px; font-family:
                                                  'Andale Mono';">0 =
                                                  RXB0 overflowed</span></li>
                                              <li class=""><span
                                                  class=""
                                                  style="font-size:
                                                  14px; font-family:
                                                  'Andale Mono';">1 =
                                                  RXB1 overflowed</span></li>
                                              <li class=""><span
                                                  class=""
                                                  style="font-size:
                                                  14px; font-family:
                                                  'Andale Mono';">T = TX
                                                  buffer has become
                                                  available</span></li>
                                              <li class=""><span
                                                  class=""
                                                  style="font-size:
                                                  14px; font-family:
                                                  'Andale Mono';">E =
                                                  Error/WakeUp flags
                                                  were cleared</span></li>
                                              <li class=""><span
                                                  class=""
                                                  style="font-size:
                                                  14px; font-family:
                                                  'Andale Mono';">LLLLLLLL
                                                  = intflag</span></li>
                                            </ul>
                                          </div>
                                        </div>
                                      </blockquote>
                                      <div class="">
                                        <div class=""> </div>
                                        <div class="">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 class=""> </div>
                                        <div class="">With those changes
                                          made, I get:</div>
                                        <div class=""> </div>
                                      </div>
                                      <blockquote class=""
                                        style="margin: 0 0 0 40px;
                                        border: none; padding: 0px;">
                                        <div class="">
                                          <div class="">
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;">OVMS# test
                                                  cantx can1 25000<br
                                                    class="">
                                                  Testing 25000 frames
                                                  on can1<br class="">
                                                  Transmitted 25000
                                                  frames in 6.389849s =
                                                  255us/frame</span></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;"><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></span></div>
                                            <div class=""><span class=""
                                                style="font-family:
                                                'Andale Mono';"><span
                                                  class=""
                                                  style="font-size:
                                                  14px;"><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></span></div>
                                          </div>
                                        </div>
                                      </blockquote>
                                      <div class="">
                                        <div class=""> </div>
                                        <div class="">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 class=""> </div>
                                        <div class="">Regards, Mark.</div>
                                        <div class=""> </div>
                                        <div class="">
                                          <blockquote class="">
                                            <div class="">On 7 Jul 2018,
                                              at 10:42 AM, Tom Parker
                                              <<a
                                                href="mailto:tom@carrott.org"
                                                target="_blank"
                                                rel="noopener
                                                noreferrer"
                                                moz-do-not-send="true">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 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?</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 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.</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"
                                                  target="_blank"
                                                  rel="noopener
                                                  noreferrer"
                                                  moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a><br
                                                  class="">
                                                <a
                                                  href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                                                  target="_blank"
                                                  rel="noopener
                                                  noreferrer"
                                                  moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></div>
                                            </div>
                                          </blockquote>
                                        </div>
                                      </div>
                                    </div>
_______________________________________________<br class="">
                                    OvmsDev mailing list<br class="">
                                    <a
                                      href="mailto:OvmsDev@lists.openvehicles.com"
                                      target="_blank" rel="noopener
                                      noreferrer" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a><br
                                      class="">
                                    <a
                                      href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                                      target="_blank" rel="noopener
                                      noreferrer" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></div>
                                </blockquote>
                              </div>
                            </div>
_______________________________________________ OvmsDev mailing list <a
href="mailto:OvmsDev@lists.openvehicles.com" target="_blank"
                              rel="noopener noreferrer"
                              moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
                            <a
                              href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                              target="_blank" rel="noopener noreferrer"
                              moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></blockquote>
                        </div>
                      </div>
<IMG_2835.PNG><IMG_2836.PNG>_______________________________________________<br
                        class="">
                      OvmsDev mailing list<br class="">
                      <a href="mailto:OvmsDev@lists.openvehicles.com"
                        target="_blank" rel="noopener noreferrer"
                        moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a><br
                        class="">
                      <a class="moz-txt-link-freetext"
                        href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                        moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></div>
                  </blockquote>
                </div>
              </div>
              _______________________________________________ OvmsDev
              mailing list <a class="moz-txt-link-abbreviated"
                href="mailto:OvmsDev@lists.openvehicles.com"
                moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
              <a class="moz-txt-link-freetext"
                href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></blockquote>
          </div>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
        </blockquote>
        <br>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
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>
  </body>
</html>