   D |= ((uint32_t)spi_transfer(0)) << 16;  // D[23:16]
   D |= ((uint32_t)spi_transfer(0)) << 8;  // D[15:8]
   D |= ((uint32_t)spi_transfer(0));  // D[7:0]
-  digitalWrite(CPLD_SS_PIN, HIGH);
+  CPLD_SS_SET();
 #ifdef SHOW_ALL_FLASH_ACCESS
   Serial.print("Flash read *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);

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