Hot![SOLVED] PIC32MZ Possible Cause of software reset

Author
MKC
Super Member
  • Total Posts : 399
  • Reward points : 0
  • Joined: 2009/12/04 13:24:27
  • Location: Belgium
  • Status: offline
2015/03/11 02:57:55 (permalink)
0

[SOLVED] PIC32MZ Possible Cause of software reset

Application stops from time to time due to software reset.
 
The debugger execution Memory indicates that CPU is set to Reset address."0xBFC0_0000"
Reset control register "RCON" value 0x0000-0040 indicates a Software reset.
 
I don't see any cause for a software reset besides the special sequence as in the Section 7 Resets (see code).
But i don't have this code in my application, is there any other possible cause for a software reset.
Any hidden Harmony code?
 
Setup:
- PIC32MZ Embedded Starter Kit
- LCC Graphic Pictail Plus board
- Graphic Display PowerTip 4.3"
- Using Harmony 1.03 
- USB host
- file system
- LCC (only driver)
 
/* The following code illustrates a software Reset */
/* perform a system unlock sequence */
SYSTEMUnlock();
/* set SWRST bit to arm reset */
RSWRSTSET = 1;
/* read RSWRST register to trigger reset */
volatile int* p = &RSWRST;
*p;
/* prevent any unwanted code execution until reset occurs*/
while(1);

 
 
Any information appreciated
Marc,
post edited by MKC - 2015/03/12 11:00:42
#1

8 Replies Related Threads

    bikeoid
    Super Member
    • Total Posts : 168
    • Reward points : 0
    • Joined: 2010/04/30 05:58:38
    • Location: 0
    • Status: offline
    Re: PIC32MZ Possible Cause of software reset 2015/03/11 05:56:21 (permalink)
    0
    At first I wondered if it was an alignment or math error, but those all seem to have separate reset status bits.
     
    The equivalent XC32 PIC software library call is SoftReset().   It's worth searching the project files to see if one of the Harmony files in the project contains that call.
     
    #2
    bikeoid
    Super Member
    • Total Posts : 168
    • Reward points : 0
    • Joined: 2010/04/30 05:58:38
    • Location: 0
    • Status: offline
    Re: PIC32MZ Possible Cause of software reset 2015/03/11 06:03:11 (permalink)
    4 (1)
    Oops, the SoftReset() is the PIC32MX call, the equivalent for PIC32MZ is PLIB_RESET_SoftwareResetEnable()
    #3
    aschen0866
    Super Member
    • Total Posts : 4400
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re: PIC32MZ Possible Cause of software reset 2015/03/11 07:44:34 (permalink)
    3 (1)
    You need to implement _general_exception_handler and _nmi_handler so that you can find the cause of a soft reset. Take a look MZ datasheet Chapter 7.
    #4
    MKC
    Super Member
    • Total Posts : 399
    • Reward points : 0
    • Joined: 2009/12/04 13:24:27
    • Location: Belgium
    • Status: offline
    Re: PIC32MZ Possible Cause of software reset 2015/03/11 08:04:24 (permalink)
    0
    Thanks for your help,
     
    When the CPU has been powered OFF for a time the issue comes within say 10 minutes.
    The issue seems to be absent if the CPU is ON for a time.
     
     
    I am now working on a release build with information on screen about the restart and exception, so i can put the eval. kit in the fridge. To see if temperature is a parameter in this story.
     
    I have been scanning the complete Harmony V1.03 directory (this includes all lib's and app's)
    The function "PLIB_RESET_SoftwareResetEnable" can been found in a lot off ".a" files (this seems normal to me)
    PLIB_RESET_SoftwareResetEnable is also used in "sys_reset.c" see code box
    void SYS_RESET_SoftwareReset( void )
    {
        PLIB_DEVCON_SystemUnlock(DEVCON_ID_0);

        if (PLIB_RESET_ExistsSoftwareResetTrigger(RESET_ID_0))
            PLIB_RESET_SoftwareResetEnable(RESET_ID_0);
    }
     
     
    Future scanning for the function "SYS_RESET_SoftwareReset" gives me detection in some specific application examples
    like bootloaders and files like sys_command.c and flashmem.c
     
    But non of this is used in my project.
     
    Marc,
     
    #5
    MKC
    Super Member
    • Total Posts : 399
    • Reward points : 0
    • Joined: 2009/12/04 13:24:27
    • Location: Belgium
    • Status: offline
    Re: PIC32MZ Possible Cause of software reset 2015/03/11 09:58:11 (permalink)
    0
    Update,
     
    void _general_exception_handler(void)
    function was already implemented and compiled without optimization, and the issue is not calling the exception function.
    So i tested the exception handler by launching following code
    void ExceptionGenerateAddrError (void)
    {//function for testing the exception handler
     volatile char* p;

     p= 0xFFFFFFFF;
     *p =1;
    }

     
    This does generate an exception except it jumps to my
    "void _on_reset (void)" function (see TABLE 7-1) and not to my "void _general_exception_handler(void)" function.
     
    Using this exception test function i can see the CAUSE register set to 0x0480_000C so it does generates an address error.
     
    Confused about exception handler in MZ part i have no problem with MX part
    1. According to the map file and to the execution memory dump the "void _general_exception_handler(void)" function exists in memory. 
    2. The Vector at 9D00_0180 has the label "_gen_exception"
    3. The above code jumps to "void _on_reset (void)" and not to "void _general_exception_handler(void)" and not to "void _nmi_handler (void)" and not to 0x9D00_0180 (the exception vector)
    4. The CPU jumps to the "void _on_reset (void)" function after a debugger reset, so this is correct.
     
    Marc,
     
     
     
     
     
    #6
    MKC
    Super Member
    • Total Posts : 399
    • Reward points : 0
    • Joined: 2009/12/04 13:24:27
    • Location: Belgium
    • Status: offline
    Re: PIC32MZ Possible Cause of software reset 2015/03/11 13:20:22 (permalink)
    0
    Update MZ CPU has major problem ..... i guess
     
    Information about the original problem,
    An exception seems to jump to the reset vector, however using the debugger i have about all the information i need.
    And it is strange....
    1. CPU uses special interrupt vectors
    2. Code Fetch exception and code seems normal
    3. Peripherals REFxx seems to be set to zero
    Detailed information in att.
    Register CAUSE =  0x4080-0008 according section 50 ====== use the special interrupt vector!!!!!
     
    bit 23 IV: Interrupt Vector bit
    Indicates whether an interrupt exception uses the general exception vector or a special interrupt vector
    1 = Use the special interrupt vector (0x200)
    0 = Use the general exception vector (0x180)
    If the IV bit (Cause<23>) is ‘1’ and the BEV bit (Status<22>) is ‘0’, the special interrupt vector represents
    the base of the vectored interrupt table
     
    bit 6-2 EXCCODE<4:0>:
    Exception Code bits 8>>2 = 2 => TLB exception (load or instruction fetch)
     
    ErrorEPC = 0x9D02-EE8C => Program counter at last error
    Code at this address
    LW V0,4688(V0) => V0 == 0xBF80-0000
    J 0x9D02EE5C
     
    In attachment information
    - CPU registers
    - Execution code at ErrorEPC
    - Peripheral registers (see different value for REF01 to REF04 are set to zero)
    - Peripherals after restart 
     
    Marc
     
     
     
    #7
    MKC
    Super Member
    • Total Posts : 399
    • Reward points : 0
    • Joined: 2009/12/04 13:24:27
    • Location: Belgium
    • Status: offline
    Re: PIC32MZ Possible Cause of software reset 2015/03/12 11:00:15 (permalink)
    3 (1)
    The question about the software reset is sloved
    see posts http://www.microchip.com/forums/m851940.aspx
     
    Marc,
    #8
    arpatel
    Starting Member
    • Total Posts : 43
    • Reward points : 0
    • Joined: 2019/01/09 23:24:14
    • Location: 0
    • Status: online
    Re: PIC32MZ Possible Cause of software reset 2019/01/17 17:33:24 (permalink)
    0
    I have got a similar problem. PIC32MZ stucking in reset mode after software reset. It is not initialising again.
    MCU: PIC32MZ2048EFM064
    Harmony : 2.04
    MPLAB X 4.15
     
    #9
    Jump to:
    © 2019 APG vNext Commercial Version 4.5