View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
Reset instruction Vs normal power up |
Posted: Tue Apr 03, 2018 10:04 am |
|
|
I have a program running on a PIC18F67J50.
This program receive instructions from UART1 and one of those instructions it starts a software reset.
Before perform the reset I'm saving some variables to an SPI EEPROM and set all the general purpose RAM to zero.
The special register are not changed by my program in any way.
I also clean all the GPRs as soon as the main() starts.
The program runs ok if start from a normal power up but doesn't work as expected after a soft reset or MCLR reset.
Things, like USB CDC doesn't work at all.
I read the datasheet and some special registers remains unchanged on all resets except by POR or BOR.
Can be that the difference?
Any idea about what look for? _________________ Electric Blue |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Wed Apr 04, 2018 2:16 am |
|
|
The reset instruction is a hardware reset, So is MCLR. Some bits are 'undefined' after these, but these are generally bits that are 'indeterminate' at power on. The exceptions are only the handful of bits in the RCON register. It should function the same. The obvious likely difference is that the other hardware attached, won't have reset. So if (for instance) you have a peripheral chip that you initialise, from a power on reset this will be starting in a 'reset' state, while from a MCLR/soft reset this will already be initialised. You need to look at how you perform your initialisation of every external device, and whether this will work from a warm start. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Wed Apr 04, 2018 8:45 am |
|
|
Thanks for your answer.
I have a GPS and a modem which I turn off with a P MOSFET(high side).
Also I have an SPI EEPROM and an SPI Flash(SPI bus shared) and two one wire temperature sensors.
Now I have noticed that when I shut off the GPS and the modem modules I have 3.27V from TX RX UART, so I changed the program to turn off the UARTs when they are being turned off so I do not have any current flowing to a shuttered module. _________________ Electric Blue |
|
|
|