   spi_transfer((uint8_t)((D & 0xff00L) >> 8L));  // D[15:8]
   spi_transfer((uint8_t)(D & 0xffL));  // D[7:0]
   spi_transfer(0);
-  digitalWrite(CPLD_SS_PIN, HIGH);
+  CPLD_SS_SET();
 #ifdef SHOW_ALL_FLASH_ACCESS
   Serial.print("Flash write *0x");
   Serial.print(A, HEX);


  // Set up fast SPI comms on SERCOM2 with CPLD
  pinMode(CPLD_SS_PIN, OUTPUT);
  digitalWrite(CPLD_SS_PIN, HIGH);
  cpld_spi.begin();
  pinPeripheral(CPLD_MOSI_PIN, PIO_SERCOM_ALT);
  pinPeripheral(CPLD_SCK_PIN, PIO_SERCOM_ALT);

#define CPLD_SCK_PIN 23
// PA10 / SERCOM2.2 (SERCOM-ALT) - D34 - cpld_SS
#define CPLD_SS_PIN 34
#define CPLD_SS_PORT (PORT->Group[0])
#define CPLD_SS_PORT_BIT 10
#define CPLD_SS_SET() do { CPLD_SS_PORT.OUTSET.reg = 1 << CPLD_SS_PORT_BIT; } while (0)
#define CPLD_SS_CLEAR() do { CPLD_SS_PORT.OUTCLR.reg = 1 << CPLD_SS_PORT_BIT; } while (0)
// #define CPLD_SS_CLEAR() digitalWrite(CPLD_SS_PIN, LOW)
// #define CPLD_SS_SET() digitalWrite(CPLD_SS_PIN, HIGH)
// PA11 / SERCOM2.3 (SERCOM-ALT) - D22 - cpld_MISO
#define CPLD_MISO_PIN 22

