• AVR Freaks

software reset on PIC32MZ

Author
allex_etcetera
Starting Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2016/11/08 05:58:03
  • Location: 0
  • Status: offline
2017/07/21 03:29:27 (permalink)
0

software reset on PIC32MZ

 

Hi to all.
Has anyone managed to do a software reset on PIC32MZ?
What I am actually asking is which function replaces SoftReset() that was used with PIC32MX?
Any help is more than welcome :).
#1

13 Replies Related Threads

    martinw7750
    Super Member
    • Total Posts : 295
    • Reward points : 0
    • Joined: 2013/05/28 01:31:19
    • Location: UK
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 03:52:12 (permalink)
    0
    try
     
    SYS_RESET_SoftwareReset();
     
     that's assuming you're using harmony.....
    #2
    allex_etcetera
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2016/11/08 05:58:03
    • Location: 0
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 04:08:29 (permalink)
    0
    yes, I'm using Harmony but in which library is that function? Compiler keeps on banging about undefined reference to `SYS_RESET_SoftwareReset'?
    #3
    martinw7750
    Super Member
    • Total Posts : 295
    • Reward points : 0
    • Joined: 2013/05/28 01:31:19
    • Location: UK
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 04:26:26 (permalink)
    0
    check out the system services documentation
     
    MPLAB Harmony System Service Libraries Help.pdf
     
    Triggering a Software Reset
    Describes how to use the Reset System Service Library to cause a system reset.
    Description
    Software Reset Trigger
    Software can trigger the a system reset by using the SYS_RESET_SoftwareReset function.
    Example
    SYS_RESET_SoftwareReset();
    Note: On devices that support software reset functionality, this routine never returns. Execution continues from the reset
    vector, following the reset. On devices that do not support software reset,
    #4
    martinw7750
    Super Member
    • Total Posts : 295
    • Reward points : 0
    • Joined: 2013/05/28 01:31:19
    • Location: UK
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 04:28:51 (permalink)
    0
    the prototype is in sys_reset.h
    #5
    allex_etcetera
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2016/11/08 05:58:03
    • Location: 0
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 04:33:12 (permalink)
    4 (1)
    i found the prototype but it seems it doesn't have a .c code for it. probably not supported for pic32mz.
    #6
    martinw7750
    Super Member
    • Total Posts : 295
    • Reward points : 0
    • Joined: 2013/05/28 01:31:19
    • Location: UK
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 05:14:55 (permalink)
    0
    yes it is - I use the pic32mz
     
    maybe you haven't enabled system services in harmony
    #7
    martinw7750
    Super Member
    • Total Posts : 295
    • Reward points : 0
    • Joined: 2013/05/28 01:31:19
    • Location: UK
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 05:19:00 (permalink)
    0
     
    you should find the source in your project tree:
     
    SourceFiles/framework/system/reset/src/sys_reset.c
     

    void SYS_RESET_SoftwareReset( void )
    {
        PLIB_DEVCON_SystemUnlock(DEVCON_ID_0);
        #if defined(PLIB_RESET_ExistsSoftwareResetTrigger)
        if (PLIB_RESET_ExistsSoftwareResetTrigger(RESET_ID_0))
        {
            PLIB_RESET_SoftwareResetEnable(RESET_ID_0);
        }
        #endif    
    }
     

     
    post edited by martinw7750 - 2017/07/21 05:23:49
    #8
    martinw7750
    Super Member
    • Total Posts : 295
    • Reward points : 0
    • Joined: 2013/05/28 01:31:19
    • Location: UK
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 05:25:57 (permalink)
    5 (1)
    this is how I reboot my application:
     

    void DoWarmStart(void)
    {
            // MUST disable interrupts and dma, as reset timing is critical
            // use the compiler built-in function to disable interrupts
        SYS_INT_StatusGetAndDisable();
            // use the Peripheral Library Function to suspend the DMA
        PLIB_DMA_SuspendEnable(DMA_ID_0); // only required if you are using DMA
            // use the System Service Library Function to initiate the reset
        SYS_RESET_SoftwareReset(); // to perform the reset
    }

    #9
    allex_etcetera
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2016/11/08 05:58:03
    • Location: 0
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 05:34:11 (permalink)
    4 (2)
    found it!
    it really wasn't enabled in harmony system service.
    works fine now.
    thanks a lot, you've saved my day :)
    #10
    martinw7750
    Super Member
    • Total Posts : 295
    • Reward points : 0
    • Joined: 2013/05/28 01:31:19
    • Location: UK
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 05:43:31 (permalink)
    0
    allex_etcetera
    found it!
    it really wasn't enabled in harmony system service.
    works fine now.
    thanks a lot, you've saved my day :)


    no probs
    #11
    NKurzman
    A Guy on the Net
    • Total Posts : 18180
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/21 06:00:03 (permalink)
    3 (1)
    The Harmony docs don't list the headers or dependacies for functions.
    #12
    moser
    Super Member
    • Total Posts : 525
    • Reward points : 0
    • Joined: 2015/06/16 02:53:47
    • Location: Germany
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/24 03:22:43 (permalink)
    3 (1)
    NKurzman
    The Harmony docs don't list the headers or dependacies for functions.

    True. But at least it "tries" to list the headers and dependencies for each library. I'm using the term "tries", because to my experience that information is often not reliable.
     
    For example for the Reset System Service Library it says:
    Description
    Interface Header File: sys_reset.h
    The interface to the Clock System Service is defined in the sys_reset.h header file, which is included by the sys.h header file.
    Any C language source (.c) file that uses the Reset System Service must include sys.h.

    First, you might notice, that it should be system.h instead of sys.h (which is a typical error in the docs).
    Module Dependencies
    The Reset System Service Library depends on the following modules:
    • Reset Peripheral Library
    • Device Control Peripheral Library

    Second, if you look at sys_reset.c you may see, that it also includes the not mentioned "Device Control System Library"("system/devcon/sys_devcon.h") although it doesn't make any use of it. 
    Even if you ignore such small things, I can tell from other libraries that the dependencies in the docs are sometimes not correct.
     
    But most of the time the docs are pointing you into the right direction.
    #13
    NKurzman
    A Guy on the Net
    • Total Posts : 18180
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: software reset on PIC32MZ 2017/07/24 05:39:02 (permalink)
    0
    Yes pointing you in the right direction a lot of the time is a good goal for documentation.
    I am glad to see they have improved in the 2 years since I have started with Harmony.
    There is only so many time you can read documentation that is incomplete or wrong in the hope it maybe better. V1.XX was practically abandoned when 2.XX was announced.
    I did no notice major improve menus in 2.XX but I will look again.
    #14
    Jump to:
    © 2020 APG vNext Commercial Version 4.5