本帖最后由 longfenghugui 于 2015-12-10 15:43 编辑
现有两块STM32的板子,一个SPI主机,一个SPI从机,
主机发送程序
HAL_Delay(1000);
ucSpi_Tmessage_initial[7]=ucDevice_eChecksum(ucSpi_Tmessage_initial,7);
HAL_SPI_TransmitReceive_IT(&hspi1,ucSpi_Tmessage_initial,ucSpi_Rmessage,1);
while(hspi1.State!= HAL_SPI_STATE_READY);
HAL_SPI_TransmitReceive_IT(&hspi1,&ucSpi_Tmessage_initial[1],&ucSpi_Rmessage[1],1);
while(hspi1.State!= HAL_SPI_STATE_READY);
HAL_SPI_TransmitReceive_IT(&hspi1,&ucSpi_Tmessage_initial[2],&ucSpi_Rmessage[2],1);//ucSpi_Rmessage
while(hspi1.State!= HAL_SPI_STATE_READY);
HAL_SPI_TransmitReceive_IT(&hspi1,&ucSpi_Tmessage_initial[3],&ucSpi_Rmessage[3],1);
while(hspi1.State!= HAL_SPI_STATE_READY);
HAL_SPI_TransmitReceive_IT(&hspi1,&ucSpi_Tmessage_initial[4],&ucSpi_Rmessage[4],1);
while(hspi1.State!= HAL_SPI_STATE_READY);
HAL_SPI_TransmitReceive_IT(&hspi1,&ucSpi_Tmessage_initial[5],&ucSpi_Rmessage[5],1);
while(hspi1.State!= HAL_SPI_STATE_READY);
HAL_SPI_TransmitReceive_IT(&hspi1,&ucSpi_Tmessage_initial[6],&ucSpi_Rmessage[6],1);
while(hspi1.State!= HAL_SPI_STATE_READY);
HAL_SPI_TransmitReceive_IT(&hspi1,&ucSpi_Tmessage_initial[7],&ucSpi_Rmessage[7],1);
while(hspi1.State!= HAL_SPI_STATE_READY);
从机一直送8个字节
简单说就是主机发送0K,主机接收OK,从机接收OK,就是从机发送不OK,又不能单步调试,有没有什么调试SPI的好方法啊,为什么从机发送就是不OK啊
好烦啊,有没有大神啊
|