I wonder if can use the Arduino Nano SPI-pins(MOSI,MISO & SCK) as I/O pins in a sketch? and still be able to program over ISP?

Of course I will physical disconnect the Arduino from any other hardware before programming.

enter image description here

  • why do you ask this?
    – Juraj
    Commented Mar 26, 2020 at 12:35

1 Answer 1


Yes, you can use SPI in your sketch just as you like. The programming over ISP is triggered by resetting the microcontroller. That means, that when trying to program over ISP your sketch (which configures the SPI hardware for use) doesn't run. The programming is starting at a stage, before the sketch runs, thus the sketch cannot interfere.

By the way: The same is correct for programming over Serial, though for a different reason. Programming over Serial is done by the bootloader, which runs before your sketch.

  • So I can use them as digital I/O:s and I can also use the TX/RX as I/O:s but then I will be unable to use the COM-port to talk to the PC during operation, have I got it correctly? Commented Mar 26, 2020 at 10:50
  • Yes, you can use the SPI pins as IOs, as you like. For the hardware Serial pins TX and RX: You can configure them as IO, but you should consider cutting the traces to the USB Serial chip, that are connected to them. The lines of Serial (UART) are actively high. The USB Serial chip can interfere with the intended functions of the pins, when you don't cut the traces.
    – chrisl
    Commented Mar 26, 2020 at 10:54
  • @chrisl - Usually that is not a problem. The USB serial interface connects to the processor via 1k resistors. When used as an output the processor can overdrive the resistor. When used as an input the driving source needs to be powerful enough to drive the 1k resistor as well as the processor. Commented Mar 26, 2020 at 20:28

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.