1
\$\begingroup\$

I am learning about microcontrollers in school now and I was looking at the schematics of the microcontroller board that we use in the lab and came across the boot switch and the reset switch. The positioning of the reset switch and the boot swicth can be found in the schematic below.

enter image description here

My question is why is the boot switch located at Pin 37 instead of being located at say Vdd? [pin diagram below]

enter image description here

And, if I am looking to add a boot switch to other PICs (maybe PIC10F200), where do I add it?

\$\endgroup\$
13
  • \$\begingroup\$ I see no reset switch in the schematic. \$\endgroup\$ Nov 27, 2017 at 5:08
  • \$\begingroup\$ @IgnacioVazquez-Abrams Will edit it \$\endgroup\$ Nov 27, 2017 at 5:09
  • \$\begingroup\$ What does the boot switch do? Start a bootloader? The reset should be connected to VDD, but boot sounds like a firmware feature, not a reset or power button, so I don't see why it would be connected to VDD. \$\endgroup\$
    – Ron Beyer
    Nov 27, 2017 at 5:11
  • \$\begingroup\$ @RonBeyer Its a firmware feature I guess, because we press the reset button and the boot button simultaneously before loading a hex file into the PIC. Do you know why it's connected to pin 37? \$\endgroup\$ Nov 27, 2017 at 5:15
  • 1
    \$\begingroup\$ check this out ... picprojects.net/usbbootloader/index.html \$\endgroup\$
    – jsotola
    Nov 27, 2017 at 5:22

1 Answer 1

4
\$\begingroup\$

That boot switch is part of your lab, and not a default property of the pic. It is just attached to a GPIO pin which would be enabled in code as either some sort of "wake from sleep/low power" function(if that microcontroller has a low power state), or if the controller was programmed with a state machine that waited until that button was pressed before moving on.

There is no default "boot" switch or the pic microcontroller, as there is no default boot sequence. As described in this response, a boot sequence implies there is some sort of bios or boot loader. When a microcontroller powers on it just starts running through the code in order, there is no "boot sequence", it just starts executing code and the only reason it would wait for a switch press is because you explicitly told it to do so.

As far as why it's connected to pin 37 specifically, if you look at page 20 of the datasheet, you can see the functions of that pin. One of which is the "pin change interrupt", meaning you can write an interrupt routine that will trigger when that button is pressed, but you don't have to poll that pin in code.

Continuing on to your second question of adding a boot switch to another controller, you don't have to add a boot switch to the microcontroller, so I'm unclear if you're asking this because you feel it is necessary, or because you have a specific project in mind, but to add it to another microcontroller you would just attach it to any gpio pin and then associate it in code to the action you want it to perform(boot or otherwise). Any gpio will do, but if you specifically want it to trigger an interrupt you'll need to consult the data sheet or that microcontroller to find a pin-change-interrupt enabled pin.

Edit: Updating to include sweber's comment.

Microcontrollers can have a bootloader, that would then take advantage of a button, but it is not something inherent to the pic, that is something that was added for your labs development board.

This is similar in vein to the 'ATMEGA' vs 'ARDUINO' scenario. When most people get involved with microcontrollers, a lot of them start calling everything that might be a microcontroller an "Arduino", when all an Arduino is, is an Atmega(Usually Atmega328p) with the Arduino bootloader on it on a circuit board with an FTDI chip for serial communication over usb. This allows it to be flashed with firmware from the Arduino IDE. NONE of this is an inherent function of the Atmega microcontroller. If you purchased an atmega328p directly from Microchip you would then need to purchase an In System Programmer(ISP) specific to your chip line to flash your firmware onto the chip. For the pic you are using you would use the picKit.

Microchip provides the tools and information to write your own bootloader or make use of the space, so if you wanted to implement this yourself it's possible, just a higher level project.
Link to Microchip bootloader tools/information Link to an already made Microchip Bootloader which includes more explanation of how a bootloader works.

\$\endgroup\$
1
  • \$\begingroup\$ From the comments, this is definitely used for the bootloader. Since the bootloader (and so handling of this pin) is a separate piece of code, this pin might not be used in the code written / edited by the TS, or at least it is not used for any bootloader related functionality. \$\endgroup\$
    – sweber
    Nov 28, 2017 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.