AnsweredAssumed Answered

LPC11C24 SPI read not working

Question asked by Chris Idema on Jun 18, 2018
Latest reply on Jun 27, 2018 by Chris Idema

We have a project where we need SPI.

We have full communication using bitbanging, but we can't get it to work using the peripheral.

On the logic analyser all signals seem to be correct (and identical to bitbanging, except timing), but the read register is empty.

What are we doing wrong?

void test_spi(void)
{
    SSP_ConfigFormat ssp_format;
    Chip_SSP_DATA_SETUP_T xf_setup;
        
    Chip_SYSCTL_PeriphReset(RESET_SSP0);
    
    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
    
    Chip_GPIO_Init(LPC_GPIO);
    
    Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO0_9, IOCON_FUNC1);
    Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO0_8, IOCON_FUNC1);
    Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO2_11, IOCON_FUNC1);
    
    //init SSN:
    Chip_GPIO_SetPinOutHigh(LPC_GPIO, 0, 2);
    Chip_GPIO_SetPinDIROutput(LPC_GPIO, 0, 2);
    Chip_GPIO_SetPinOutHigh(LPC_GPIO, 0, 2);
    
    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SSP0);
    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SSP1);
    
    Chip_SSP_Init(LPC_SSP0);
    
    Chip_SSP_Int_Enable(LPC_SSP0);
    
    Chip_SSP_SetFormat(LPC_SSP0, SSP_BITS_8, SSP_FRAMEFORMAT_SPI,       SSP_CLOCK_CPHA0_CPOL0);

 

    Chip_SSP_Enable(LPC_SSP0);
    
  slave_select_set();
  Chip_SSP_SendFrame(LPC_SSP0, 0x28);
  nfc_buffer[0] = Chip_SSP_ReceiveFrame(LPC_SSP0);
  Chip_SSP_SendFrame(LPC_SSP0, 0x80);
  nfc_buffer[1] = Chip_SSP_ReceiveFrame(LPC_SSP0);
  slave_select_clear();
}
       

Outcomes