I've a question about how to correctly wire some microcontrollers pins.

In particular:

  • Interrupt pin on microcontroller (pull up/pull down resistor and with which value)
  • Output clock pin from a microcontroller to an FPGA or another microcontroller (if are necessary capacitors or resistors)
  • PWM pins that drive LEDs or MOSFETS
  • SPI pins(MISO, MOSI, SCK, CS) they should have some kind of pull up or pulldown like I2C?
  • \$\begingroup\$ Hard to say, this all depends on the microcontroller you're using. The datasheet of the uC should answer most of your questions. Maybe you should read a book on how to use a uC. \$\endgroup\$ – Bimpelrekkie Jun 19 '15 at 8:39
  • \$\begingroup\$ What specifically do you want to know? I suggest using PCB traces. \$\endgroup\$ – Nick Johnson Jun 19 '15 at 8:43
  • \$\begingroup\$ I found something on datasheets. But nothing about Clock pin from microcontroller to another device(sensor, fpga, another mcu), should I use a specific connection or I can connect directly? \$\endgroup\$ – Singe Jun 19 '15 at 10:42
  • \$\begingroup\$ @Singe How are you thinking of making this direct connection? We're curious to know if you mean making it with a breadboard and wires or if you're talking about PCB design. LED's need a current limiting resistor. Pull-up/pull-down is used for buttons etc. Things that don't have 2 absolute states, but can float. SPI doesn't need anything else. \$\endgroup\$ – Paul Jun 19 '15 at 11:56
  • \$\begingroup\$ @FauZe With a PCB design. \$\endgroup\$ – Singe Jun 20 '15 at 9:00

There is no general answer to all part of your question because a lot of these features are microcontroller and periphery specific. Always read the datasheet about restrictions and requirements.

1. External Interrupts

Here I describe you an example which uses an AVR microcontroller (e.g.: Atmega128), but there are many other family with different options. There are different ways to configure an interrupt pin so there are different ways to wire it up.
We have three options in this case:

  1. The low level of INTn generates an interrupt request.
  2. The falling edge of INTn generates asynchronously an interrupt request.
  3. The rising edge of INTn generates asynchronously an interrupt request.

In case 2. we could use a pull-up resistor on the pin and connect it to GND through a button. So when we push the button a falling edge will be sensed and an interrupt will be genereted.
We could do it in reverse in case 3. by using a pull-down resistor to GND and a button to the supply voltage. Here we get a rising edge. (R3 resistor is used to avoid direct connection the the VCC.)


simulate this circuit – Schematic created using CircuitLab

Here I used buttons but there could be other interrupt sources which could have specific instructions about how to wire them.

2. Clock output

Unfortunately I do not have enough experience to provide an answer to this part.

3. PWM pins

As far as I know PWM pin could be directly connected to the Gate of a MOSFET unless the datasheet tells otherwise. (As for LEDs a current limiting resistor is useful.)

Example (PWM controlled FET LED driver):

enter image description here

4. SPI pins

SPI lines do not require pull-up resistors.
Generally the CLK, MOSI, CS pins could be simply connected, on MISO pin an 1k serial resistor could be usful to protect the controller input pin. (This protection is just for sure, if you accidentally change the MISO pin to output and for example it is in HIGH state and the other side is in LOW, this would connect GND and VCC and that we do not want to happen.)

Always refer to the datasheets or try to find similar projects which use the same hardware and see their solutions.


On an input pin, the need for a pull-up is dependent on the type of circuit that is driving it. If that circuit will only sink current (switch to ground, open drain output ...) then you will need a pull-up. For outputs, if it's an open drain (or open collector), you will need a pull-up. You need to look at the data sheets for both ends of a signal to determine if an additional current source is required.


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.