SPI between Master arduino and Slave arduino How can I send the string from Slave SPI to Master SPI?
I want to write code in Bare Metal.
The problem which I am facing is I can't make out what will be my blocking function in Master SPI code when receiving data from slave SPI.
As my SPIF bit is cleared in MAster code as soon as I shift out SPDR register from master to receive byte which is coming from the slave.
#define spi_data_reg SPDR     
//Naster read byte function
    uint8_t MA_SPI0_read_byte()
    {    
        spi_port &amp;= ~(1&lt;&lt;SS);
        spi_data_reg = 0;
        while(!(SPSR &amp; (1&lt;&lt;SPIF)));                  //Wait until transmission complete
        return(spi_data_reg);                                 //Return received data
       spi_port |= (1&lt;&lt;SS);
    }
    
    //Slave send byte function
    void SL_SPI0_send_byte(uint8_t data)
    {
        spi_data_direc=(1&lt;&lt;MISO);   //MISO as OUTPUT
        spi_data_reg = data;
        while(!(SPSR &amp;(1&lt;&lt;SPIF)));
    }
Feel free to take a look at my YouTube videos. They are not monetized so I'm not self-promoting. You can even skip the videos and checkout my GitHub repo with the Master and Slave sketches.
https://youtu.be/A9oSX_dwJKQ
https://youtu.be/PSUzhCtNRRQ
https://github.com/linhartr22/Arduino_SPI_Master_Slave_Demo