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?
Best Answer
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:
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):
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.