SPI speed

Hi all,

I mounted an Ethernet Shield 2 on a Due.
I am wondering why the client.write(buf, len) call is taking some milliseconds for 1 KByte of data. I understand that the send buffer has to be transferred to the Ethernet chip TX buffer by SPI bus first. The performance of SPI depends on SPI communication frequency.

Different Ethernet libs request different SPI speeds. However, measuring the SCK (Serial Clock) frequency by an oscilloscope, much lower results surprised me:

  • Adafruit Ethernet (Ethernet2.h): Requested 8 MHz but measured 1.5 MHz clock speed
  • PJS Ethernet (default): Requested 14 MHz but measured 2.0 MHz clock speed
  • PJS Ethernet: Requested 30 MHz (OK with W5500 chip), but measured 2.2 MHz clock speed
  • Wiznet Ethernet: Requested 42 MHz, but measured 4.6 Mhz clock speed

Following Reference/SPISettings one may only request the "maximum" SPI speed. So I expected to measure a lower speed, but not that low. I also read that the SPI speed has to be supported by the slave. Looking at the data sheet of the Wiznet W5500 chip, there is stated on page 62:

The minimum guaranteed speed of the SCLK is 33.3 MHz which was tested and measured with the stable waveform.

Otherwise PJS would not have provided a switch in his Ethernet library for setting 30 MHz.

How comes I measured only 2 MHz clock speed? Is there a flaw?

TIA
Simon

By "PJS Ethernet", do you mean this one:

simon_due:
How comes I measured only 2 GHz clock speed? Is there a flaw?

I'm guessing you meant 2 MHz.

@pert
Yes, I meant GitHub - PaulStoffregen/Ethernet: Ethernet library for Teensy and thx for the typo hint.