@dirkc Unfortunately I cannot test the setup right now, but this should work: ... ... #elif defined(SPI_PINS_CSN9_CE8) #define CSN_PORT PORTB // port for CSN #define CSN_DDR DDRB // DDR for CSN #define CSN_PIN PB1 // Arduino Pin 9 <-> Bit 1 of port B #define CE_PORT PORTB // port for CE #define CE_DDR DDRB // DDR for CE #define CE_PIN PB0 // Arduino Pin 8 <-> Bit 0 of port B #endif and static void initSPI(void) { ... ... #elif defined(SPI_PINS_CSN9_CE8) // set pin mode: MOSI,SCLK,CE,CSN = OUTPUT, MISO = INPUT (=> all on same port) SPI_DDR = _BV(SPI_MOSI) | _BV(SPI_SCLK) | _BV(CE_PIN) | _BV(CSN_PIN) | ~_BV(SPI_MISO); #endif