AnsweredAssumed Answered

SPI Slave Mode

Question asked by jlia on Jan 19, 2016
Latest reply on Jan 26, 2016 by jlia

Hello,

 

I'm trying to configure my BF707 as a SPI Slave, though getting the error ADI_SPI_CONFIGURATION_ERROR from adi_spi_SetSlaveSelect()

 

Below is my code:

 

// configure and de-assert the GPIO chip-selects for the boot eeprom

  ADI_GPIO_RESULT gResult;

 

 

  // configure SPI bus for the boot eeprom

  ADI_SPI_RESULT sResult;

  sResult = adi_spi_Open(SPI_FACEPLATE_BUS, SPIDriverMemory,sizeof(SPIDriverMemory), &g_hSpiDevice );

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  //@todo eventually need to set this false to be slave

  sResult = adi_spi_SetMaster( g_hSpiDevice, false );

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  //@todo this might need to be true for slave mode

  sResult = adi_spi_SetHwSlaveSelect( g_hSpiDevice, false );

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_SetTransmitUnderflow( g_hSpiDevice, true );

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_SetClockPhase( g_hSpiDevice, false );

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_SetClock( g_hSpiDevice, 1000u );

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_SetSlaveSelect( g_hSpiDevice, ADI_SPI_SSEL_ENABLE1 );

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_SetWordSize( g_hSpiDevice, ADI_SPI_TRANSFER_8BIT );

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_SetTxWatermark( g_hSpiDevice,

  ADI_SPI_WATERMARK_50,

  ADI_SPI_WATERMARK_DISABLE,

  ADI_SPI_WATERMARK_DISABLE);

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_SetRxWatermark( g_hSpiDevice,

  ADI_SPI_WATERMARK_50,

  ADI_SPI_WATERMARK_DISABLE,

  ADI_SPI_WATERMARK_DISABLE);

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_RegisterCallback( g_hSpiDevice, &SpiDmaCallback, NULL);

  assert (sResult == ADI_SPI_SUCCESS );

 

 

  sResult = adi_spi_EnableDmaMode( g_hSpiDevice, true );

  assert (sResult == ADI_SPI_SUCCESS );

 

I can't seem to find an example of using SPI in slave mode anywhere.

Outcomes