阅读:1827回复:0
S3C2440 SPI接收问题请教
S3C2440 SPI接收问题请教, 程序代码如下所示. 2440通过SPI连接CAN芯片,通过SPI读取CAN芯片状态寄存器状态,示波器能够抓到MISO,MOSI,SCK的正确波形,说明数据发送和接收都是正确的,可就是2440寄存器SPRDAT0没有数值,始终是0. 各位大侠估计什么原因?
SPI_CtrlBlk.pSPIReg->SPTDAT0 = 0xaa; RETAILMSG(1, (TEXT("SPI_Read send = 0x%x \\r\\n"), SPI_CtrlBlk.pSPIReg->SPTDAT0)); DWORD dwRet = WaitForSingleObject(SPI_CtrlBlk.hSPIEvent, SPI_RX_DELAY); InterruptDone(SPI_CtrlBlk.SPI_Intr); if (dwRet == WAIT_TIMEOUT) { RETAILMSG (1, (TEXT("- ")TEXT(__FUNCTION__)TEXT(" WAIT_TIMEOUT %d \\r\\n"), GetLastError() )); return 0; } recv = SPI_CtrlBlk.pSPIReg->SPRDAT0; RETAILMSG(1, (TEXT("SPI_Read recv = 0x%x \\r\\n"), recv)); |
|