用ST芯片,SPI读取正常。换成GD芯片后,按照官方提供的GD和ST差异表,修改了程序,u8 SPI_FLASH_SendByte(u8 byte) 返回值全是0xff,有人遇到过这种情况吗?
u8 SPI_FLASH_SendByte(u8 byte) //
{
/* Loop while DR register in not emplty */
while ((SPI1->SR & SPI_I2S_FLAG_TXE) == 0);
/* Send byte through the SPI1 peripheral */
SPI1->DR =byte;
/* Wait to receive a byte */
while ((SPI1->SR & SPI_I2S_FLAG_RXNE) == 0);
/* Return the byte read from the SPI bus */
return SPI1->DR;
}
|