Hi
Yes you can improve the performance by doing some changes to the SPI library. We ran some tests and by using the SPI.setClockDivider(dividers) we got with the divider SPI_CLOCK_DIV4 4Mhz which is the standard, with the SPI_CLOCK_DIV2 we received 8.33MHz. In case you haven’t used this function it is normally used in the void setup(), and it looks like this:
SPI.setClockDivider(SPI_CLOCK_DIV2)
The dividers available for this are SPI_CLOCK_DIV2, SPI_CLOCK_DIV4, SPI_CLOCK_DIV8, SPI_CLOCK_DIV16, SPI_CLOCK_DIV32, SPI_CLOCK_DIV64 and SPI_CLOCK_DIV128. The SPI_CLOCK_DIV2 is the fastest and SPI_CLOCK_DIV8 the slowest.
The library for the SPI is located in C:\Arduino-1.5.3\hardware\arduino\x86\libraries\SPI. We modified the SPI.cpp file, in the section that says “void SPIClass::setClockDivider(uint8_t clkDiv)”, in there are some cases, which dictates the behavior of the dividers used in the setClockDivider function. To improve the speed we changed the value of the SPI_CLOCK_DIV2 by modifying the line
maxSpeedHz = SPI_CLK_DEFAULT_HZ << 1;
And we change the value to 2, and the line looked like this:
maxSpeedHz = SPI_CLK_DEFAULT_HZ << 2;
With this modification we got 12.5MHz, and if you change the value to 3 it will give 25MHz. You can try with this, but I really don’t know if this change will affect anything else, and the signal might not be as accurate as with lower speeds, but If you decide to try it let us know your results.
Regards
JPMontero_Intel