/* Transfer procedure */ while (TxIdx < BufferSize) { /* Wait for SPI1 Tx buffer empty */ while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET); /* Send SPI1 data */ SPI_I2S_SendData(SPI1, SPI1_Buffer_Tx[TxIdx++]); }
/* Wait for DMA1 channel4 transfer complete */ while (!DMA_GetFlagStatus(DMA1_FLAG_TC4));
/* Check the corectness of written data */ TransferStatus = Buffercmp(SPI2_Buffer_Rx, SPI1_Buffer_Tx, BufferSize); /* TransferStatus = PASSED, if the transmitted and received data are equal */ /* TransferStatus = FAILED, if the transmitted and received data are different */
/* Wait for DMA1 channel4 transfer complete */ while (!DMA_GetFlagStatus(DMA1_FLAG_TC4));
/* Check the corectness of written data */ TransferStatus = Buffercmp(SPI2_Buffer_Rx, SPI1_Buffer_Tx, BufferSize); /* TransferStatus = PASSED, if the transmitted and received data are equal */ /* TransferStatus = FAILED, if the transmitted and received data are different */