0
\$\begingroup\$

I have doubts about the boot sequence of about every microcontroller but since I own a PIC I figure I should start with those first. I would like someone to explain how the PIC's boot sequence progresses. While explaining that I would also like to know how the PIC sets its clock setting such as internal or external clock without first knowing which one to use does it use its internal clock and then sets the clock to external once the register has been set?

asked Feb 1, 2015 at 16:46
\$\endgroup\$
3
  • \$\begingroup\$ This depends on a PIC family. Some can switch to the internal oscillator when user-defined fails, some other don't. Boot sequence is given in the datasheet. It is, again, specific to the family. \$\endgroup\$ Commented Feb 1, 2015 at 17:20
  • \$\begingroup\$ How is this not directly and clearly answered in the datasheet? \$\endgroup\$ Commented Feb 1, 2015 at 18:59
  • \$\begingroup\$ @OlinLathrop Datasheet? TL;DR ... ;) \$\endgroup\$ Commented Feb 2, 2015 at 3:59

3 Answers 3

2
\$\begingroup\$

PIC don't really have "boot sequences", since that's a software abstraction and there is no standard software that runs on a PIC, like a bios on a PC. PIC are generally programmed with code that performs a dedicated task, usually without a operating system. The code is stored in the same non-volatile memory it is executed from (except some PIC 32s can be set up to execute from RAM), so there is nothing to "boot".

The diferrent PIC architectures vary a bit in what happens on powerup or after a reset, but mostly execution just starts at a single known address. The start of your code has to be at that address.

As for configuration settings that have to be made before any code can execute, like the oscillator selection, these are stored in the configuration bits. These are special non-volatile bits that are used directly by the hardware.

This is, of course, all described in detail in the datasheet or family reference manual.

answered Feb 1, 2015 at 18:59
\$\endgroup\$
2
  • \$\begingroup\$ Could you explain how the config bits are used? As in when the system powers up, what circuitry is responsible for reading and setting those values. \$\endgroup\$ Commented Feb 1, 2015 at 19:20
  • \$\begingroup\$ The oscillator circuitry directly reads those bits. On most PICs, they are written only in programming mode. \$\endgroup\$ Commented Feb 1, 2015 at 19:23
1
\$\begingroup\$

The boot sequence of a PIC is:

  1. Start executing the code at the reset vector.

That's it.

answered Feb 2, 2015 at 0:23
\$\endgroup\$
0
\$\begingroup\$

For every architecture is basically the same. It starts whichever oscillator you configured with fuses, counts say a 1000 stable cycles and vectors to start location (this is usually location 0 in flash).

From then on it vectors to the startup, which more or less just initialises the ram variables and after that is done it vectors to your main() function.

From then on your SW starts running.

Which PIC family?

answered Feb 1, 2015 at 18:17
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.