lpcware

LPC Link-2_SPI_No data in data register

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Dark Star on Mon Aug 11 12:17:58 MST 2014
Im working with LPCXpresso and LPC Link-2 board (LPC4370). I wanted to poll SPI data (SSP1), but there is nothing else than a 0 in there. Also the RNE bit is never set. SPI is configuted as Slave. The signals from the master is o.k. (MOSI, SCLK, SEL).

My code:

Init:
/* P1.19 connected to SCL/SCLKSCU_MODE_FUNC1=SSP1 SCK1 */
Chip_SCU_PinMuxSet(0xF, 4, (SCU_PINIO_FAST | SCU_MODE_FUNC0));
/* P1.20 connected to nCSSCU_MODE_FUNC1=SSP1 SSEL1 */
Chip_SCU_PinMuxSet(0x1, 20, (SCU_PINIO_FAST | SCU_MODE_FUNC1));
/* P0.0 connected to SOSCU_MODE_FUNC1=SSP1 MISO1 */
Chip_SCU_PinMuxSet(0x1, 3, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC5));
/* P0.1 connected to nSISCU_MODE_FUNC2=SSP1 MOSI1 */
Chip_SCU_PinMuxSet(0x1, 4, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC5 | MD_EZI));

Chip_SSP_Init(LPC_SSP);

ssp_format.frameFormat = SSP_FRAMEFORMAT_SPI;
ssp_format.bits = SSP_BITS_16;//16;//SSP_DATA_BITS;
ssp_format.clockMode = SSP_CLOCK_MODE0;
Chip_SSP_SetFormat(LPC_SSP, ssp_format.bits, ssp_format.frameFormat, ssp_format.clockMode);
Chip_SSP_SetMaster(LPC_SSP, 0); // Set as Slave
Chip_SSP_Enable(LPC_SSP);

Polling:
        while (Chip_SSP_GetStatus(LPC_SSP, SSP_STAT_RNE)) {
                Chip_SSP_ReceiveFrame(LPC_SSP);
        }
        spi_data = *(unsigned short*)(temp_spi_data.rx_data);


Does anybody have an idea?  :~

Outcomes