新手上路
- 积分
- 33
- 金钱
- 33
- 注册时间
- 2017-7-20
- 在线时间
- 12 小时
|
6金钱
项目需要做一个3线spi通信,mosi和miso在同一根线上,MCU能够发送数据给从机,但是一直读不到从机发送的数据,请大神帮忙看看哪里有问题
/*配置MISO引脚*/
GPIO_InitStructure.GPIO_Pin = SGM71612_SPI_MISO_PIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(SGM71612_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
u16 SPI_SGM71612_send(u16 byte)
{
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET){};
SPI_I2S_SendData(SPI1, byte);
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET){};
return SPI_I2S_ReceiveData(SPI1);
}

|
|