SSP (SP1) Slave mode sample code...
Is anybody having LPC2148 SSP (SPI1) slave mode example code.
I am trying to establish communication between two LPC device. One act as SSP (SPI1) master and another act as SSP (SPI1) slave device.
If anybody having LPC21xx SSP (SPI1) slave mode sample code, please let me know.
Thanks & Best Regards,
This is my master and slave mode configuration. Can anyone help me to find out, what mistake i have done for slave mode configuration. Master mode is working well. But slave doesn't receive any data from master.
void SPI1Init( void )
/* Configure PIN connect block */
/* bit 32, 54, 76 are 0x10, bit 98 are 0x00 */
/* port 0 bits 17, 18, 19, 20 are SSP port SCK1, MISO1, MOSI1, and SSEL1 */
/* set SSEL to GPIO pin that you will have the totoal freedom to set/reset
the SPI chip-select pin */
SSPCR1 = 0; /* SSP Disable */
PINSEL1 |= 0x00A8;
/* SSEL configuration */
/* Set PCLK to the same as CCLK */
VPBDIV = 0x01;
/* Set DSS data to 8-bit, Frame format SPI, CPOL = 0, CPHA = 0, and SCR is 0 */
SSPCR0 = (7 << 0) | (0 << 4) | (0 << 6) | (0 << 7) | (0 << 8);
/* SSPCPSR clock prescale register, master mode, minimum divisor is 0x02 */
SSPCPSR = 16; /* SCK1 = PCLK / (CPSDVSR * [SCR+1]) */
/* SSP Interrupt Enable Mask */
SSPIMSC = 0;
if ( 0)
SSPCR1 &= ~(1 << 2); /*master mode*/
SSPCR1 |= (1 << 2); /*slave mode*/
SSPCR1 |= (1 << 1); /* SSP Enable */