I use arduino Mega 2560 to work as Master and Maple as slave to test whether my maple can read data correctly. Mega 2560 generate data at the speed of 2Mhz.
I alternately generate 00000000 and 00001001.
Here is the code for arduino to generate data
#include <SPI.h>
int i=0;
void setup() {
pinMode (50, OUTPUT);
pinMode (52, OUTPUT);
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setClockDivider(SPI_CLOCK_DIV2);
SPI.setDataMode(SPI_MODE1);
}
void loop() {
SPI.transfer(9);
SPI.transfer(0);
}
And this is the code for Maple to read data
HardwareSPI spi(1);
int i;
void setup() {
spi.beginSlave(MSBFIRST, 1);
}
void loop() {
byte response = spi.read();
SerialUSB.println(response, BIN);
}
I find that the the data read by Maple is not 00000000 and 00001001 show up alternately, it seems, several 00000000 and then several 00001001 or something.
Does this means my maple is overflow and lost some data?