GIE on various reset types

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

GIE on various reset types

Post by SHughes_Fusion » Mon Apr 28, 2014 12:53 pm

I'm struggling to find anything in the Microchip datasheets which documents what happens to the GIE bit on a reset.

I'm using the PIC18F26K22. The datasheet confirms that on a power-on or brown-out reset, GIE will be set to zero which in effect will disable interrupts. However, nothing documents what happens on a watchdog reset.

I'm seeing some odd serial output when my unit suffers a watchdog reset and the only cause I can think of is that the interrupt is being called as soon as the processor starts, rather than once the various flags, pointers etc have been set up.

Of course I'm not intending to have regular watchdog resets once the software is finished and robust but I'd like to understand this issue and remove it if possible to make sure there isn't an underlying problem.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: GIE on various reset types

Post by Jerry Messina » Mon Apr 28, 2014 3:22 pm

For the most part all of the reset sources do the same thing... they result in a CHIP_RESET. There are a few exceptions like the RCON register, but pretty much everything's outlined in Chap 4 and Table 5-2.

Strange things could happen if you get a reset while the uart is sending a char, or perhaps you're seeing the result of a floating TXD line, since reset tri-states all of the IO pins.

If you don't pullup TXD it's possible to get garbage on the line when the chip powers up/down/resets, depending on what you have attached to it. The debuggers (like the PICKit3) can also cause issues if you enable the "Halt peripherals on break" setting.

The other thing to watch out for when using the TXIF is that it's set as soon as you enable the intr to signal that the buffer's empty.

Post Reply