Transfer16() in SPI for RTL8720(bw16)

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

I have not tried a RTL8720 yet...

Is MISO connected to MOSI?

I connected MISO and MOSI and it worked for transfer(). Still have to test transfer16().

https://forum.amebaiot.com/t/trying-to-connect-bw16-to-wiz5500-using-spi/2833/9

The record of progress is as above.

Regards and good wishes.

Rintin

Succeeded in using transfer16().

Regards

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.