Sorry to re-open this. I’m doing my hardware design. I read different opinions about what to do with unused pins. I’d like to have the hardware as stable as possible (regarding EMC, EMI).
Some suggest to configure them as outputs and adding an external pull-down. Some as inputs with an external pull-down. There is also some information about the Startup default for different pins (a short LOW as I understood right).
I was wondering what is the correct thing to do with the SPI pins. Right now I configure them like that (from what I understood SPI.begin does it in that way as well).
I don’t use SPI2 right now but might use it in the future (but my hardware design needs to be ready for it).
pinMode(A2, OUTPUT); // unused SPI SS will be set as output
pinMode(A3, OUTPUT); // SPI SCK
pinMode(A4, INPUT); // unused SPI MISO
pinMode(A5, OUTPUT); // SPI MOSI
pinMode(D2, OUTPUT); // unused SPI2 MOSI
pinMode(D3, INPUT); // unused (SPI2 MISO)
pinMode(D4, OUTPUT); // unused SPI2 SCK
pinMode(D5, OUTPUT); // unused SPI2 SS