• AVR Freaks

Hot!PIC32MZ Software Reset RCON

Author
tahoe
New Member
  • Total Posts : 20
  • Reward points : 0
  • Joined: 2018/01/30 11:27:12
  • Location: 0
  • Status: offline
2019/06/20 16:32:45 (permalink)
0

PIC32MZ Software Reset RCON

Hello, We putting our product through certain test scenarios that ultimately is generating above the average amount of noise which causing our microcontroller to reset. Most of the time we a get a brownout and power on reset in the RCON register. Every once in a while we get the software reset bit gets set in RCON register. I am little hardpressed where to start to debug the software reset bit being set in the RCON register. Please can anyone provide any assitance on this topic.
#1

17 Replies Related Threads

    Jim Nickerson
    User 452
    • Total Posts : 6259
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/20 17:51:55 (permalink)
    0
    As this is caused by "noise" I would guess it is jumping into a random code sequence or maybe an exception handler.
    I presume you are outputting the RCON register via some serial port.
    You are not running in debug mode are you ?
    #2
    tahoe
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/30 11:27:12
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/21 10:26:13 (permalink)
    0
    Hello Jim,
     
    Yes, I am viewing the status of the RCON register through a serial port.  Running in debug mode is almost impossible as I lose my debug connection because of the nose.  
    #3
    maxruben
    Super Member
    • Total Posts : 3366
    • Reward points : 0
    • Joined: 2011/02/22 03:35:11
    • Location: Sweden
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/23 08:52:07 (permalink)
    0
    You say "noise". What kind of tests, RF radiation, conductive RF, ESD or magnetic field? You must figure out what is happening on your board and remedy that. The "noise" is mostly ground related and must get back to the source without disturbing your electronics.That's why you need solid groundplanec, decoupling and shielding.
     
    /Ruben
    #4
    tahoe
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/30 11:27:12
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/23 22:00:10 (permalink)
    0
    Thanks, maxruben
     
    You hit it on the money pretty much all of those things. We design x-ray system between 3Mev - 10Mev.   Just a bit confused about how I would get a software reset bit set in the RCON register and not always.  As is it's always who fault is it firmware or the electronics. 
    #5
    moser
    Super Member
    • Total Posts : 504
    • Reward points : 0
    • Joined: 2015/06/16 02:53:47
    • Location: Germany
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/24 04:22:13 (permalink)
    0
    You could try to write several exception handlers, for example:
    _general_exception_handler ()
    _simple_tlb_refill_exception_handler()
    _cache_err_exception_handler()
    _bootstrap_exception_handler()
    _nmi_handler()
    _DefaultInterrupt()

    Within these handlers, you can store some information in a memory area (e.g. a struct), which is declared __attribute__((persistent,aligned(16))). This memory survives software reset, but not power/brown-out reset. If you have a bootloader, it gets more complicated, because the bootloader must not clear it. At device start, first check if RCON.SWR is set, and if yes, then evaluate this area (e.g. via serial port or via log function or whatever). After evaluation, clear this area, so you can be sure about the data from the next handler. 
     
     
    #6
    tahoe
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/30 11:27:12
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 11:16:41 (permalink)
    0
    Thanks, moser,
     
    I added all of those exception handlers.  Now, I have done some testing and verified that at least _simple_tlb_refill_exception_works. Not sure how to trigger test the others.  So, running in debug mode I set breakpoints in all the exception handlers and something strange happens.  When this event occurs either noise or EMI (Not sure which one) I go directly to instruction in the execution memory
    "BEQ ZERO, ZERO, _reset_switch_isa.  Not sure what this is really telling me.  Any advice? 
     
     
     
     
    #7
    aschen0866
    Super Member
    • Total Posts : 4504
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 11:30:24 (permalink)
    0
    tahoe
    .  When this event occurs either noise or EMI (Not sure which one) I go directly to instruction in the execution memory
    "BEQ ZERO, ZERO, _reset_switch_isa.  Not sure what this is really telling me.  Any advice? 
     



    It means the reset has already happened. What is in the RCON register?
    #8
    tahoe
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/30 11:27:12
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 11:38:52 (permalink)
    0
    Thanks for your response,
     
    The RCON states a couple of different things like POR, BROWNOUT, BCFGERR and statistically, the WDT happens more frequently. Should any of the exceptions occur they should fire correct? 
    #9
    friesen
    Super Member
    • Total Posts : 2081
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 12:37:45 (permalink)
    0
    RCON isn't self clearing.

    Erik Friesen
    #10
    tahoe
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/30 11:27:12
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 12:48:23 (permalink)
    0
    Not sure what you mean? We have a command line tool that we zero out the RCON registers every time we reset.  So, we read it out then clear it.   
    #11
    aschen0866
    Super Member
    • Total Posts : 4504
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 13:49:03 (permalink)
    0
    tahoe
     
    The RCON states a couple of different things like POR, BROWNOUT, BCFGERR and statistically, the WDT happens more frequently. Should any of the exceptions occur they should fire correct? 


    An ESD event could trigger a configuration mismatch reset (BCFGERR). There is nothing software can do to correct this problem.
    #12
    tahoe
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/30 11:27:12
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 14:10:38 (permalink)
    0
    Could this be the reason for our random resets? 
    #13
    friesen
    Super Member
    • Total Posts : 2081
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 14:18:49 (permalink)
    0
    This one will only be conquered by sweat and tears?
     
    If you simply have to know whats happening, I'd suggest tapping a high speed serial uart, as fast as your converter and uart baud rates work together, and tracing this thing.
     
    When things go awry in an IC, its kind of hard to know exactly what is happening.  For example, a number of years back I was using a 10uf Tantalum on the pic32mx460f512l chips, and the thing would get into a non responsive state where an mclr wouldn't reset it. 
     
    What it took to figure this out what that a soft reset would trigger this on a pic32mx795f512 using the same cap.  Replacing the core cap with a 10uf ceramic fixed this issue.
     
    My guess is that the software bit on rcon is just collateral damage.

    Erik Friesen
    #14
    tahoe
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/30 11:27:12
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/25 15:06:03 (permalink)
    0
    Thank for the reply,
    Trying to neck it down to attack hardware or firmware.  Would WDT reset cause exceptions handlers not to trigger?  
     
    #15
    moser
    Super Member
    • Total Posts : 504
    • Reward points : 0
    • Joined: 2015/06/16 02:53:47
    • Location: Germany
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/26 05:38:49 (permalink)
    0
    tahoeI added all of those exception handlers.  Now, I have done some testing and verified that at least _simple_tlb_refill_exception_works. Not sure how to trigger test the others.

    Some other examples are given here: https://www.microchip.com/forums/FindPost/1059769
    And I think you can test the _DefaultInterrupt() by enabling an interrupt for which you did not create an handler. Watchdog and Deadman will call _nmi_handler(), but only if you set RNMICON.NMICNT to get some time before the reset. And if that time is not enough, clear RNMICON WDTO and DMTO flags in the _nmi_handler() to stop the countdown. I don't think you will ever see the cache error until you explicitly manipulate cache behavior. And bootstrap is only for errors during start up.
     
    Also friesen is right: Some RCON flags must be cleared, for example at least BOR and POR for a PIC32MZ EFM. 
     
    However, I guess all of this won't help you anyhow, and you shouldn't spend much time on it. I don't think that software things are causing your trouble. And I guess analyzing it with software won't do it, if the PIC even has starting problems. To me it seems some electrical effects are causing the reset. And then during the following PIC restart even the read of the configuration words is not working properly (BCFGERR). Both probably due to the same problem. But I can't help you there.
     
    Maybe you should tell the processor type you are using.
    #16
    rjc101
    Super Member
    • Total Posts : 108
    • Reward points : 0
    • Joined: 2016/07/08 14:56:34
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/26 08:07:11 (permalink)
    0
    Be wary setting bits in the RCON register, I found a silicon bug that still hasn't made it into the data sheets (and this was in 2017!).  So depending on your particular variant odd things may happen if you set any "reserved" bits.
     
    This was confirmed via a support ticket, with the solution "Setting bits 24 or 26 of the RCON register causes unexpected behaviour."
     
    https://www.microchip.com/forums/m984600.aspx
     
    #17
    tahoe
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/30 11:27:12
    • Location: 0
    • Status: offline
    Re: PIC32MZ Software Reset RCON 2019/06/26 13:44:21 (permalink)
    0
    Thankfully we are not setting any bits on the RCON register.  Primarily only using it as a status read-only register  
    #18
    Jump to:
    © 2019 APG vNext Commercial Version 4.5