For an intership, I need to program the Arduino function SPI.transfer(data) (https://www.arduino.cc/en/Refere...) in Atmel Stuido.
I use the microprocessor SAM3X8E (https://ww1.microchip.com/downlo..., page 676-707 for the SPI part).
I did this function :
static inline uint8_t spi_transmit(uint8_t data)
/* Transmission of the data/
SPI0->SPI_TDR = data;
/* wait the end of the transmission*/
while(SPI0->SPI_SR & SPI_SR_RDRF == 0);
/* return the data receive */
return (SPI0->SPI_RDR & SPI_RDR_RD_Msk);
(Note : SPI_RDR_RD_Msk is a mask to select the 16 bits which interess me of the register RDR)
But this function doesn't do the transmission I think...
Can you see anything bad in this function ?
Thank you !