Strange SPI behaviour

UNO rev4 WiFI board

If I setup pin 13 as an OUTPUT [ e.g. pinMode(SCK_PIN, OUTPUT) ; // clock 13 ] after [ #define SCK_PIN 13 ] … There is no clock generated when I attempt to send SPI data.

If I do not define the clock pin as an OUTPUT , SPI transfers work i.e. there is a clock signal generated.

Why do you find that strange ?

If that is a problem, then one solution is to not use pinMode() on SCK_PIN.

It was unexpected (and interpreted by me as strange), as I assumed that it was necessary to explicitly define the pins. However if it is only necessary to define the CS pin - that’s fine.

if it is only necessary to define the CS pin

Why not have a look at the actual requirements for using the Uno R4 SPI library?

That is an advanced microprocessor, and what you might have learned from ATmega-based Arduinos does not necessarily apply.

Keep in mind that the Arduino company has lately been rolling out a series of unfinished products with incomplete documentation and only partially debugged libraries, so the job of informing yourself is far from a simple one.

Good idea… however CS (defined) alone works, but I also found my own error - I was setting the other pins AFTER SPI.begin() instead of before it.