Configure Arduino Due as SPI slave

In SAM3X8E datasheet section 33.8.2 pg.no:699 described how to configure SPI as slave mode. I set SPI_MR = SPI_MR & 0xFF0F00FE; MSTR set to 0. when i compiled got

error: 'SPI_MR' was not declared in this scope. Is it right?

Thanks Venkatesh

I get the same error, however it seems to be declared here on my Mac:

/Applications/Arduino_Due_1.5.2.app/Contents/Resources/Java/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3n/include/component/component_spi.h

Also here, and in a few other places:

/Applications/Arduino_Due_1.5.2.app/Contents/Resources/Java/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/include/component/component_spi.h

I don’t know enough about the build process to comment on why those includes don’t seem to be active, perhaps someone else can help?

you have to state the correct spi instance

as seen in
/hardware/arduino/sam/system/libsam/source/spi.c

{snip out lots of code}
extern void SPI_Configure( Spi* spi, uint32_t dwId, uint32_t dwConfiguration )
{
    pmc_enable_periph_clk( dwId ) ;
    spi->SPI_CR = SPI_CR_SPIDIS ;

    /* Execute a software reset of the SPI twice */
    spi->SPI_CR = SPI_CR_SWRST ;
    spi->SPI_CR = SPI_CR_SWRST ;
    spi->SPI_MR = dwConfiguration ;   ///<------------------------------------------------------------
}
{more code follows }

Here i did config after digging all files from hardware folder in sam for pin register's have a try and reply.

void setup();
{
pinMode(PIN_SPI_MISO,OUTPUT);
  REG_SPI0_MR = REG_SPI0_MR & 0xFF0F00B6;
  REG_SPI0_WPMR = REG_SPI0_WPMR & 0xFF0F00FE;
  
  REG_SPI0_CR=0x1;
  
  REG_SPI0_CSR=0x00000400; //Configured to 8bit transfer & 21MHz
}

Im getting "FF" reply from due(slave) in rpi(master)