2006-10-24 04:10 AM
2011-05-17 12:33 AM
Hi,
i´m tryinig to communicate over the SSP interface. I´ve tried the SSP example from ST and it works fine, but i can receive data even if there ist no connection between the MOSI and MISO PINs. The Data are given out on the MOSI Pin, but if I put the pin to ground i receive the sent data too. There must be a bug in the receive register. Has anyone an idea why? Here´s my code: /* SSP0 configuration */ SSP_DeInit(SSP0); SSP_InitStructure.SSP_FrameFormat = SSP_FrameFormat_Motorola; SSP_InitStructure.SSP_Mode = SSP_Mode_Master; SSP_InitStructure.SSP_CPOL = SSP_CPOL_High; SSP_InitStructure.SSP_CPHA = SSP_CPHA_2Edge; SSP_InitStructure.SSP_DataSize = SSP_DataSize_8b; SSP_InitStructure.SSP_ClockRate = 5; SSP_InitStructure.SSP_ClockPrescaler = 2; SSP_Init(SSP0, &SSP_InitStructure); /* SSP0 enable */ SSP_Cmd(SSP0, ENABLE); for(k=0; k SSP0_Buffer_Rx[k] = SSP_ReceiveData(SSP0); Tx_Idx=Rx_Idx=0; /* Slave to master transfer procedure */ while(Tx_Idx{ SSP_SendData(SSP0, SSP0_Buffer_Tx[Tx_Idx++]); while(SSP_GetFlagStatus(SSP0, SSP_FLAG_RxFifoNotEmpty)==RESET); SSP0_Buffer_Rx[SSP0RxBufferControl++] = SSP_ReceiveData(SSP0); } greeni :-W [B]2011-05-17 12:33 AM
Check SSPx->CR1 register, bit 0, Loopback mode, even the library.
2011-05-17 12:33 AM
Hello,
look on the discussion from 27.09.2006. If you use an SPI-Master, the NSS-Pin must be tied to VCC