Hot!Pic18F25K80 ECAN - bit stuff errors due to switching to config mode

Author
Alex4WAG
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2011/07/09 04:04:09
  • Location: 0
  • Status: offline
2017/12/10 04:32:38 (permalink)
0

Pic18F25K80 ECAN - bit stuff errors due to switching to config mode

Hello everyone,
 
I have an application based on a PIC18F25K80 and a MCP2561 communicating successfully on the CAN bus in an endless loop.
I am using the CAN filter to ignore unimportant messages. So far so good - no error frames on the CAN bus. The filter is set once when the program starts.
When I am now adding a code changing the CAN filter in my loop, I am getting endless bit stuff error frames on the bus.
I have isolated the switch to configuration mode as the cause for this problem. Nevertheless the filter is set correctly.
This is the subroutine used for switching the operation mode:
Public Sub CANSetOperationMode(mode As Byte) // mode is %10000000 in this case
  CANCON = mode // Request desired mode.
  While((CANSTAT And CAN_OP_MODE_BITS) <> mode)
    ClrWDT
  Wend // Wait till desired mode is set.
End Sub

Can somebody help with this problem? Of course there would be several possible workarounds but I would like to understand what there is happening. Thank you for any idea.
 
Best regards,
 
Alex.
 
#1

3 Replies Related Threads

    HJonker
    Super Member
    • Total Posts : 489
    • Reward points : 0
    • Joined: 2006/04/19 02:17:59
    • Location: NL
    • Status: offline
    Re: Pic18F25K80 ECAN - bit stuff errors due to switching to config mode 2017/12/10 23:53:22 (permalink)
    +2 (2)
    When you change to config mode, it is likely the Tx pin reverts to a GPIO pin. Check the level to which the particular port pin is set (BEFORE having touched the can module), to ensure it remains recessive when the can module is no longer active.
     

    Kind Regards,
    Hans Jonker
    (Amsterdam, Holland)
    #2
    Alex4WAG
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2011/07/09 04:04:09
    • Location: 0
    • Status: offline
    Re: Pic18F25K80 ECAN - bit stuff errors due to switching to config mode 2017/12/11 09:03:42 (permalink)
    +1 (1)
    Thank you Hans, this fixed my problem! Smile: Smile
    #3
    tolliug
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2018/08/07 02:50:57
    • Location: 0
    • Status: offline
    Re: Pic18F25K80 ECAN - bit stuff errors due to switching to config mode 2018/09/13 03:05:19 (permalink)
    0
    Hi AlexWAG how did you solve the problem exactly? I am in front of a problem with a PIC18F46K80 and an MCP2561, after switching off/on the power supply many times, stuff errors start appearing on can bus. Then after more switch off/on manipulations, the MCP seems died and replacing the transceiver is our only option. This problem occurs earlier if we plug/unplug gnd in wild manner. 
    #4
    Jump to:
    © 2018 APG vNext Commercial Version 4.5