SPi Slave Mode on RAK3172 with RUI3

Hi,

Is it possible to set SPI to be slave mode via Arduino’s RUI3 API? Documentation doesn’t seem to mention that and the following code from Web is not working either as it is applied to Arduino DUE:

ISR (SPI_STC_vect)        //Inerrrput routine function 
{
  receivedData = SPDR;   // Get the received data from SPDR register
  received = true;       // Sets received as True 
}

void setup()
{
  Serial.begin(115200);

  pinMode(MISO,OUTPUT);   //Sets MISO as OUTPUT
  SPCR |= _BV(SPE);       //Turn on SPI in Slave Mode
  received = false;
  SPI.attachInterrupt();  //Activate SPI Interuupt 
}


void loop()
{ 
  if(received) {                        
    SPDR = receivedData;    // send back the received data, this is not necessary, only for demo purpose
    received = false;
    Serial.print(receivedData, HEX);
  }
}

Hi @lsafelix75 ,

We do not have example how to setup SPI Slave on RAK3172. This is likely possible but you have to directly control the appropriate registers on STM32WL. Even Arduino has no direct SPI slave example and it is very common to see direct register modification when an Arduino is used as SPI Slave. I believe this is the case because SPI is primarily designed to interface external devices - memories, displays, etc. and not to make itself the SPI slave.