Ethernet2 (UDP) SPI transfers have a lot of dead time

it looks like this will do both sending and receiving. Bit of a shame it overwrites the transmit buffer to do it tho

Yes, it does, and it is :frowning: It seems that it would be nice if the SPI library had more features.

I've been trying to get some "bare" SPI code to work, so I can figure out whether this is inherent slowness, or some hardware/configuration issue. But I'm having troubles getting it to work :frowning:

Ahh, there is goes... This code produces a nice tight loop, and I'd really expect it to keep that SPI clock going pretty much continuously. It doesn't :frowning: Therefore, something "interesting" is happening! (I had to modify SPI.h to make SPI.spi a publicly accessible value, but otherwise it has no modifications.)

#include <SPI.h>

Spi *myspi;

void setup()
{
  SPI.begin();
  Serial.begin(115200);
  myspi = SPI.spi;
}

void loop() {
  Serial.println("Begin bare metal SPI test");

  SPI.beginTransaction(SPISettings(28000000, MSBFIRST, SPI_MODE0));

  for (byte i = 0; i < 100; i++) {
    while ((myspi->SPI_SR & SPI_SR_TDRE) == 0)
      ; // spin
    myspi->SPI_TDR = SPI_PCS(3) | i;
  }
  SPI.endTransaction();

  Serial.println("Bare metal finished");
  delay(1000);
}