关于STM32与 Marvell88w8686的问题

2019-07-14 18:33发布

tica">Marvell88W8686是怎样与主机STM32进行数据传输的,用SPI接口,对从机需要操作的寄存器有哪些?手册大致能看懂,加上程序下面就不太明白了
  1. UINT16 GSPI_WriteByte(PSTM32SPI pSpi, UINT16 usData)
  2. {
  3. if (pSpi->ucMode == GSPI_MODE_SPI) {
  4. // Loop while DR register in not emplty,等待SPI发送寄存器里的数据发送结束
  5. while (SPI_I2S_GetFlagStatus(pSpi->SPIx, SPI_I2S_FLAG_TXE) == RESET);

  6. // Send byte through the SPI peripheral,发送数据
  7. SPI_I2S_SendData(pSpi->SPIx, usData);

  8. // Wait to receive a byte
  9. while (SPI_I2S_GetFlagStatus(pSpi->SPIx, SPI_I2S_FLAG_RXNE) == RESET);

  10. // Return the byte read from the SPI bus
  11. return SPI_I2S_ReceiveData(pSpi->SPIx);
复制代码
发送数据时,从机是怎样接收的,即将接收的数据放在哪里?





0条回答

一周热门 更多>