Register RCON

Started by wantoniet September 22, 2005
Hi Folks,

I need help to understand what is going on... Im using a PIC18F452 and
suddenly it resets when its communicating via SPI.

In such to debug this weird problem, i monitored register RCON
(register that provides the sources of reset). When i power up the
board, the register contains 12D (1100 at LSB nibble), what means that
power-on reset and brown-out occurred. When microcontroller resets
inadvertelly this register constains no more 12D, but 14D (1110 at LSB
nibble), what means power-on reset not occurred. To dive deeper in this
problem i passed to monitor register STKPTR that contains stack pointer
value. In normal power-up conditions this register must constains 0,
and this happens indeed, however when microcontroller resets (weird
problem) this register show up 01, what means that stack-pointer was
increased.

Well, once ive enabled overflow/underflow stack reset, if
microcontroller reset due stack pointer, 7th and 6th bit of STKPTR
would change to 1, but this not occur. In truth, what happens is that
stack-pointer is increased.

The worst thing is that i cant simulate, cause MPLAB SIM does not
provide serial feature simulation.

Does anybody faced with a problem like this? Another point: Im using
CCS compiler.

Im grateful for any help!!
Wilson



--- In piclist@picl..., "wantoniet" <wantoniet@y...> wrote:
> Hi Folks,
>
> I need help to understand what is going on... Im using a
PIC18F452 and
> suddenly it resets when its communicating via SPI.

The PIC and the SPI device are supplied both from the same voltage
value ? The SPI is using interrupts ?

cheers,
Vasile

>
> In such to debug this weird problem, i monitored register RCON
> (register that provides the sources of reset). When i power up the
> board, the register contains 12D (1100 at LSB nibble), what means
that
> power-on reset and brown-out occurred. When microcontroller resets
> inadvertelly this register constains no more 12D, but 14D (1110 at
LSB
> nibble), what means power-on reset not occurred. To dive deeper in
this
> problem i passed to monitor register STKPTR that contains stack
pointer
> value. In normal power-up conditions this register must constains
0,
> and this happens indeed, however when microcontroller resets
(weird
> problem) this register show up 01, what means that stack-pointer
was
> increased.
>
> Well, once ive enabled overflow/underflow stack reset, if
> microcontroller reset due stack pointer, 7th and 6th bit of STKPTR
> would change to 1, but this not occur. In truth, what happens is
that
> stack-pointer is increased.
>
> The worst thing is that i cant simulate, cause MPLAB SIM does not
> provide serial feature simulation.
>
> Does anybody faced with a problem like this? Another point: Im
using
> CCS compiler.
>
> Im grateful for any help!!
> Wilson


--- In piclist@picl..., "Vasile Surducan" <vasile@s...> wrote:
> --- In piclist@picl..., "wantoniet" <wantoniet@y...> wrote:
> > Hi Folks,
> >
> > I need help to understand what is going on... Im using a
> PIC18F452 and
> > suddenly it resets when its communicating via SPI.
>
> The PIC and the SPI device are supplied both from the same voltage
> value ? The SPI is using interrupts ?
>
> cheers,
> Vasile
>
> >
> > In such to debug this weird problem, i monitored register RCON
> > (register that provides the sources of reset). When i power up
the
> > board, the register contains 12D (1100 at LSB nibble), what means
> that
> > power-on reset and brown-out occurred. When microcontroller
resets
> > inadvertelly this register constains no more 12D, but 14D (1110
at
> LSB
> > nibble), what means power-on reset not occurred. To dive deeper
in
> this
> > problem i passed to monitor register STKPTR that contains stack
> pointer
> > value. In normal power-up conditions this register must constains
> 0,
> > and this happens indeed, however when microcontroller resets
> (weird
> > problem) this register show up 01, what means that stack-pointer
> was
> > increased.
> >
> > Well, once ive enabled overflow/underflow stack reset, if
> > microcontroller reset due stack pointer, 7th and 6th bit of
STKPTR
> > would change to 1, but this not occur. In truth, what happens is
> that
> > stack-pointer is increased.
> >
> > The worst thing is that i cant simulate, cause MPLAB SIM does
not
> > provide serial feature simulation.
> >
> > Does anybody faced with a problem like this? Another point: Im
> using
> > CCS compiler.
> >
> > Im grateful for any help!!
> > Wilson

Hi Vasile,

Yes, same supply and SPI routine runs inside an external interrupt
INT0 routine.
Thanks
Wilson