Hi,
I am trying to use transfer16() function in SPI on the Ameba 3.1.7. Following is the code
[code]
/*
* A sketch to perform a LOOPBACK Test using RTL8720 (BW16).
* Uses the SPI.h library packaged with the Ameba Arduino SDK 3.1.7.
* Loopback is performed by sending the 16 bit data out from MOSI, using transfer16 function in SPI.h.
* The same data is received back through MISO.
#include <SPI.h>
#define SPI_HAS_EXTENDED_CS_PIN_HANDLING 1
SPISettings my_spi(14000000, MSBFIRST, 0);// SPI setup
#define SPI_MODE = 'M'
uint16_t caunter;
uint16_t inn;
void setup() {
Serial.begin(115200);
Serial.println("SPI Loopback Test!");
SPI.begin();
delay(10);
}
void loop(){
for (caunter = 0; caunter <= 1000; caunter++) {
inn = SPI.transfer16(caunter,SPI_LAST);
Serial.print (caunter, DEC);
Serial.print(" -- ");
Serial.println(inn, HEX);
// delay(500);
}
}
[/code]
The sketch compiles OK. However the only 0s are returned (and printed out). I had earlier tried transfer() which worked just fine.
What am I doing wrong?
TIA
azhaque