AnsweredHot!Not Rebooting after Software Reset

Author
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
2019/01/17 01:08:11 (permalink)
0

Not Rebooting after Software Reset

PIC32MZ2048EFM doesnt reboot after Software reset.
I am using http servser with harmony 2.04 from example apps.
When    SYS_RESET_SoftwareReset() applied it just stops working. If I apply power on reset it works.
Does anyone knows this issue?
 
After applying software reset it isn't restarting.
Thanks
#1
LostInSpace
Super Member
  • Total Posts : 208
  • Reward points : 0
  • Joined: 2016/03/11 22:47:59
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/01/17 12:34:53 (permalink)
0
The help file for that function suggests,
Remarks:
The software reset feature must be supported by the processor in use.


If your processor does support this, then,
 
I would set a breakpoint in the exception handler and see if you land there after soft boot. A lot of issues end up there. 
 
HTH
 
#2
friesen
Super Member
  • Total Posts : 2029
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: Not Rebooting after Software Reset 2019/01/17 14:48:14 (permalink)
0
Is your hardware properly designed and decoupled?  This can affect a software restart.

Erik Friesen
#3
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/01/17 17:01:59 (permalink)
0
I believe that PIC32MZ2048EFM064 supports software reset and its been working properly so probably no hardware issue.
Do I need to enable any other option in harmony? OR clear reset reason when it restarts ?
#4
LostInSpace
Super Member
  • Total Posts : 208
  • Reward points : 0
  • Joined: 2016/03/11 22:47:59
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/01/18 14:50:43 (permalink)
0
I don't believe that you have to set any harmony options.
 
There is a section the XC32 compiler manual that covers exception handlers.
 
The Harmony documentation has a section: "Reset Reason Management".
 
These provide more information.
 
On all my projects there has been a stubbed function built by Harmony for the general exception handler.
This is in the file: system_config->default->system_exceptions.c
Now that I look, I see that there is a breakpoint in there already (clever!).
void _general_exception_handler ( void )
{
    /* Mask off Mask of the ExcCode Field from the Cause Register
    Refer to the MIPs Software User's manual */
    _excep_code = (_CP0_GET_CAUSE() & 0x0000007C) >> 2;
    _excep_addr = _CP0_GET_EPC();
    _cause_str  = cause[_excep_code];
    SYS_DEBUG_PRINT(SYS_ERROR_FATAL, "\n\rGeneral Exception %s (cause=%d, addr=%x).\n\r",
                    _cause_str, _excep_code, _excep_addr);

    while (1)
    {
        SYS_DEBUG_BreakPoint();
    }
}
#5
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/01/20 18:47:24 (permalink)
0
I have tried already to look into it but it doesn't print anything on my usart console.
Is there anything that I need to configure or check to make this work.
 
#6
LostInSpace
Super Member
  • Total Posts : 208
  • Reward points : 0
  • Joined: 2016/03/11 22:47:59
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/01/20 20:38:35 (permalink)
0
Put a breakpoint in main.c, do the soft reset - does that get hit?
 
Getting to the question - How do you know it is or isn't running after soft reboot?
#7
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/01/20 20:47:51 (permalink)
0
Well, It neither displaying anything on the usart console nor LED turning on, after rebooting.
Thus I concluded its not running after reseting.
 
I will try your suggestion to put break point and let you whats happen.
#8
NKurzman
A Guy on the Net
  • Total Posts : 16995
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: Not Rebooting after Software Reset 2019/01/20 20:56:04 (permalink)
0
The debugger will not auto restart on a reset.

I have a two function call harmony reset that I know works. I will try to remember to post it on Monday.
#9
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/01/20 22:15:41 (permalink)
0
I have tried it without debugger mode as well but no success.
It looks like it is stucking somewhere on startup.
I have measured a pin with oscilloscope and confirmed that MCU hasnt started.
#10
NKurzman
A Guy on the Net
  • Total Posts : 16995
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: Not Rebooting after Software Reset 2019/01/21 13:14:50 (permalink) ☄ Helpfulby arpatel 2019/02/10 17:59:53
5 (1)
This is working in Harmony V1.11
 
#include "peripheral/devcon/plib_devcon.h"
#include "peripheral/reset/plib_reset.h"
 
PLIB_DEVCON_SystemUnlock(DEVCON_ID_0);     // Do a system Unlock First
PLIB_RESET_SoftwareResetEnable(RESET_ID_0); // reset 
#11
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/02/07 22:57:57 (permalink)
0
I havent found the solution.
My MCU still stay in reset mode after software reset.
Does anybody knows this issue?
#12
NKurzman
A Guy on the Net
  • Total Posts : 16995
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: Not Rebooting after Software Reset 2019/02/08 06:44:56 (permalink)
0
Did you try what I posted?
#13
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/02/09 21:08:07 (permalink)
0
Yes I have tried that one but still have the same issue.
It works same as SYS_RESET_SoftwareReset().
 
Still, not initialise after software reset. It looks like it stay in reset mode.
Does harmony have any software reset example for pic32MZ? Or Can anybody provide small pic32mz software reset project for mplab x 5.10
 
where harmony defines reset ? I cant locate anything in system_config.h
Thanks
 
post edited by arpatel - 2019/02/09 21:51:45
#14
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/02/10 17:43:50 (permalink)
0
I have tried to reset with Watch Dog , but the same situation if I enable watch dog from software.
If enable it from fuse setting it works.
 
It looks like another bus in harmony for software reset.
If you guys find anything please let me know
Thanks
#15
NKurzman
A Guy on the Net
  • Total Posts : 16995
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: Not Rebooting after Software Reset 2019/02/10 21:56:23 (permalink)
0
You appear to be resetting. That question is why the pic is not responding after the reset.
I assume you are not trying this in debug mode.
#16
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/02/10 22:41:57 (permalink)
0
No. I am not debugging anything.
I have stop debug in fuse bits as well.
Is there any other setting for debug that I didn't turned off in harmony?
I believe there is something wrong in oscillator selection that affects the software reset.
I have selected system PLL and 100MHz as primary clock source.
Thanks
#17
moser
Super Member
  • Total Posts : 427
  • Reward points : 0
  • Joined: 2015/06/16 02:53:47
  • Location: Germany
  • Status: offline
Re: Not Rebooting after Software Reset 2019/02/11 03:27:11 (permalink) ☼ Best Answerby arpatel 2019/02/13 04:08:02
5 (1)
This is my preferred reset code:

    while(1) {
        // disable interrupts
        PLIB_INT_Disable(INT_ID_0);
        // suspend the DMA controller
        PLIB_DMA_SuspendEnable(DMA_ID_0);
        // assume the device is locked. perform a system unlock sequence
        PLIB_DEVCON_SystemUnlock(DEVCON_ID_0);
        // set SWRST bit to arm reset and read RSWRST register to trigger reset
        PLIB_RESET_SoftwareResetEnable(RESET_ID_0);
        // if failed for some extremely strange reason, try again, forever.
    }

 
However, your problem is obviously not the reset code, but the restart after the reset.
So, is the following what you are observing?
 
Code is starting:
- After programming with MPLAB X (not in debug mode)
- After programming with MPLAB X (in debug mode)
- After reset by watchdog which was configured by Configuration Bits (not in debug mode)
- After power off and on (not in debug mode)
 
Code is not starting:
- After reset by watchdog which was configured by Software (not in debug mode)
- After Software Reset (not in debug mode)
 
Are you really sure, that for the watchdog it makes a difference, whether it was configured by software or by Configuration Bits? Because that is really odd.
#18
arpatel
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2019/01/09 23:24:14
  • Location: 0
  • Status: offline
Re: Not Rebooting after Software Reset 2019/02/13 04:07:07 (permalink)
0
Thank you moser,
It helps a great. Issue resolved finally.
There was a bug in harmony. It wasn't enabling software reset bit.
I have used your code with PLIB and it works great.
 
Thanks 
 
#19
Jump to:
© 2019 APG vNext Commercial Version 4.5