In order to change this speed you can use the function setClockDivider(), for example:
Take a look at the SPI.cpp and see the options available:
#define SPI_CLOCK_DIV4 0x00 #define SPI_CLOCK_DIV16 0x01 #define SPI_CLOCK_DIV64 0x02 #define SPI_CLOCK_DIV128 0x03 #define SPI_CLOCK_DIV2 0x04 #define SPI_CLOCK_DIV8 0x05 #define SPI_CLOCK_DIV32 0x06 #define SPI_CLOCK_DIV1 0x09
Chech the SPI.cpp in there you can also change the default speed, that is 4Mhz
#define SPI_CLK_DEFAULT_HZ 4000000
Which IDE version are you using?
Thanks for the Quick reply. I'm using the Arduino 1.5.3-Intel 1.0.4 IDE. Is this of any influence? And what is the maximum clock speed achievable?
I've been looking for the SPI library:
Arduino -> package contents -> resources -> java -> libraries -> SPI -> arch
And then I could find the SPI.cpp in both the AVR as the SAM folder. Then in the SPI_CLASS.h file in the AVR folder I could fine the following list:
#define SPI_CLOCK_DIV4 0x00 #define SPI_CLOCK_DIV16 0x01 #define SPI_CLOCK_DIV64 0x02 #define SPI_CLOCK_DIV128 0x03 #define SPI_CLOCK_DIV2 0x04 #define SPI_CLOCK_DIV8 0x05 #define SPI_CLOCK_DIV32 0x06 //#define SPI_CLOCK_DIV64 0x07
which is a bit different than you describe (it's missing the DIV1, which would be the best). Also it's only in the AVR folder, and I thought the Edison is not using the AVR related libraries. Further I could not find the how to change the default clock speed. In what file/ folder is this supposed to be
I'm sorry if i'm asking trivial questions, but would be great if you could help me out,
Please post all your doubts and questions, we will be glad to help you.
You have to search for the arduino-1.5.3-Intel.1.0.4 folder in your PC, then Go to \hardware\arduino\edison\libraries in there you will find the SPI libraries.
I think you are looking in the Arduino folder for AVR boards and not in the Arduino folder related to the version that supports Intel boards.
Also, the maximum clock speed achievable is 25MHz .Check the Hardware Guide for the Edison Compute Module for more information about SPI