3
\$\begingroup\$

This is my microcontroller circuit, in which I'm using two switches. The first one is an ISP switch and the second one is a RESET switch.

enter image description here

Is there any way to use only one single switch for both functionalities? I want to make this with minimum hardware. Is there any other configuration?

\$\endgroup\$
2
  • 2
    \$\begingroup\$ You may use a Single Pole Double Throw (SPDT) switch. \$\endgroup\$ Commented Nov 21, 2022 at 6:45
  • 1
    \$\begingroup\$ Did you consider timing requirements? As long as RESET is active, the level at PIO0_I2 might be irrelevant. Please add important information by editing your question, for example a timing diagram. \$\endgroup\$ Commented Nov 21, 2022 at 7:10

3 Answers 3

3
\$\begingroup\$

By adding a capacitor, you can activate normal reset with a short press, and a bootloader/ISP reset with a long press:

schematic

simulate this circuit – Schematic created using CircuitLab

When system is first powered on, C1 is empty and keeps ISP pin high. This results in normal boot on LPC804.

If SW1 is pressed for less than 0.5 seconds, RESET will go low but ISP pin does not change that fast, resulting in restart to normal program.

If SW1 is held for more than 1 second, C1 will have enough time to charge through R2 and ISP pin will be low also, which will activate bootloader once the button is released.

R3 is not functionally needed, but it protects ISP pin against excessive current from the capacitor when VDD is powered off immediately after a button press.

\$\endgroup\$
1
  • \$\begingroup\$ very informative. \$\endgroup\$ Commented Nov 22, 2022 at 10:30
4
\$\begingroup\$

I don't think there is a common and inexpensive momentary switch that will perform this function, which I believe is to either

  1. pull the reset pin low momentarily or

  2. pull the ISP pin low while RESET is active low and release RESET while ISP is active low, then release ISP. This is done to enter bootloader mode (called DFU by some manufacturers).

Possibly a slide switch could be wired to do this, but I'd go with two inexpensive, multiple sourced and easily available momentary switches if my description above is accurate.

See this manual:

enter image description here

This implies that both reset and ISP entry pin must be simultaneously active, and reset must be released first.

\$\endgroup\$
2
  • \$\begingroup\$ can you please show me some schematic or any graphic? \$\endgroup\$ Commented Nov 21, 2022 at 8:21
  • 1
    \$\begingroup\$ See above manual excerpt. If you are willing to require the user remove and reapply power to activate the reset or entry into ISP maybe you could just have a single momentary switch for ISP. \$\endgroup\$ Commented Nov 21, 2022 at 8:54
4
\$\begingroup\$

To be a bit more precise you would need a "SPDT Center Off Momentary Switch" (also called a MOM-OFF-MOM SPDT) to mimic the two push buttons.

The switch's center lug would connect to ground, one end connects to your RESET pin and the other end connects to the PIO0_12 pin.

Flipping the switch in one direction performs the Reset, flipping it in the opposite direction performs the other function.

Here is one example of such a switch: MOM-OFF-MOM SPDT

schematic

simulate this circuit – Schematic created using CircuitLab

EDIT:
If the Reset condition must held while the PIO0-12 pin is pulsed low it may be possible to do this if the resistor and/or the capacitor values on the Reset pin are increased. That would add more delay to the rising signal on the RESET pin. With a larger value capacitor if may also be best to add a reverse biased diode on the resistor to help discharge the cap during a system power down. With that change a quick flip back & forth of the switch could initiate the ISP function with the Reset still low. Values may need some testing to insure that the basic power on reset does not become too slow

\$\endgroup\$
1
  • \$\begingroup\$ This will likely be far more expensive than two push buttons, so it may depend on what OP means with "minimum hardware". \$\endgroup\$
    – pipe
    Commented Nov 21, 2022 at 15:33

Your Answer

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

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