Post Go back to editing

SPI Slave Mode

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.

Parents Reply Children
No Data

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.