We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi...
I have interfaced LPC2366 with vinculum VDrive Module - VDrive2 on SPI (SSP0)
after referring the datasheet of vinculum(DS_VNC1L_V201.pdf) for SPI communication they have mentioned
" The SPI interface differs from most other implementations in that it uses a 13 clock sequence to transfer a single byte of data. "
Hence in my code I have made the configuration for the same, but instead of getting proper Data I am getting garbage values.
The configurations done in my code are :-
// Init..... SSP void InitSSPUSB(void) { INT8U ucDummy; INT8U ucCntr; // Configure pins for SSP interface PINSEL3 |= 0x0003C300; // Power ON SPI control PCONP |= PCSSP0; // Set DSS data to 8-bit, Frame format SPI, CPOL = 0, CPHA = 0, and SCR is 15 // SSP0CR0 = 0x0007; SSP0CR0 = 0x0707; // SSPCPSR clock prescale register, master mode, minimum divisor is 0x02 SSP0CPSR = 0x02; // SSP0CPSR = 0xFE; // for LOW Speed max ... 400kHz // Loop till FIFO size for( ucCntr = 0; ucCntr < FIFOSIZE; ucCntr++ ) { // Flush RX FIFO ucDummy = SSP0DR; } ucDummy = ucDummy; // Configure SSEL pin output direction IODIR1 |= SSEL; // Pull the pin high IOPIN1 |= SSEL; // Enable SSE SSP0CR1 = 0x02; } // Receive data over SPI void TestSPIReceiveUSB( INT8U *SPIRxData, INT16U uiLenght ) { INT16U uiCntr; for( uiCntr = 0; uiCntr < uiLenght; uiCntr++ ) { // This is important if not then NO resposne SSP0DR = 0xFF; // Wait until Receive FIFO is empty while ( !( SSP0SR & SSPSR_RNE ) ); // Read SSP port data *SPIRxData = SSP0DR; // Increment address of the poiter to point to next byte SPIRxData++; } } void main() { // call SPI receive handler function TestSPIReceiveUSB((INT8U *)&SPIRxData[0], 8); // Call a function to display the received data on UART }
Does I am making a mistake in setting 13 clock sequence ( SSP0CR0 = 0x0707) to transfer a single byte of data ?