AnsweredAssumed Answered

ADSP-BF538F SPI0 INTEFACING

Question asked by ketan on Nov 19, 2014
Latest reply on Dec 3, 2014 by CraigG

Hello guys,

 

 

I am working on configuring a slave device with ADSP-BF538F and I am able to generate SPI clock and Slave select. The isssue is that I find no signal getting generated on the MOSI pin. I checked the return value of submitbuffer function which is not zero, so I feel probably submitbuffer is the culprit.

 

 

Here is the code any valuable suggestions would be of great help.

 

 

Wishing you a beautiful day ahead

 

 

Thank you.

K.Ketan

 

 

int SPI0(void)

{

 

 

    /* flag indicating that a SPI transceiver is available */

    static bool bAvailable = false;

 

 

    /* pointer to store transceiver */

    ADI_SPI_TRANSCEIVER *pTrans;

 

 

    /* SPI driver handle */

    ADI_SPI_HANDLE hSPI0Device;

 

 

    /* SPI driver memory */

    uint8_t driverMemory[ADI_SPI_INT_MEMORY_SIZE];

 

 

    /* driver API result code */

  ADI_SPI_RESULT result;

 

 

  /* transceiver buffers */

  uint8_t Prologue[4]  = {0x00, 0x01, 0x02, 0x03};

  uint8_t TxBuffer[8]  = {0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02, 0x03};

  uint8_t RxBuffer[8];

 

 

  /* transceiver configurations */

  ADI_SPI_TRANSCEIVER Transceiver1  = {&Prologue[0], 4, &TxBuffer[0],8, NULL, 0};

  ADI_SPI_TRANSCEIVER Transceiver2  = {NULL,         4, &TxBuffer[0],8, NULL, 0};

 

 

    /* open the SPI driver */

    result = adi_spi_Open(0, driverMemory,ADI_SPI_DMA_MEMORY_SIZE, &hSPI0Device);

 

 

    /* Set master */

    result = adi_spi_SetMaster( hSPI0Device,true);

 

 

    /* Set slave select using hardware*/

    result = adi_spi_SetHwSlaveSelect( hSPI0Device, true);

 

 

    /* Selecting slave1 as the device*/

    result = adi_spi_SetSlaveSelect( hSPI0Device,ADI_SPI_SSEL_ENABLE1);

 

 

    /* Setting the word size of 8 bytes*/

    result = adi_spi_SetWordSize( hSPI0Device, ADI_SPI_TRANSFER_8BIT);

 

 

    /* Setting the clock frequency of spi   The frequency of the SPI clock is calculated by SCLK / 2* (Baud=3)*/

    result = adi_spi_SetClock( hSPI0Device, 20);

 

 

    /* No call backs required*/

  result = adi_spi_RegisterCallback(hSPI0Device, NULL, NULL);

 

 

    /* Disable DMA */

  result = adi_spi_EnableDmaMode(hSPI0Device, false);

 

 

    /* submit the SPI transceiver's buffers */

 

 

  result = adi_spi_SubmitBuffer(hSPI0Device, &Transceiver1);

  //result = adi_spi_SubmitBuffer(hSPI0Device, &Transceiver2);

  //result = adi_spi_ReadWrite(hSPI1Device, &Transceiver1);

 

 

 

 

  /* wait here until a transceiver is available */

  while(bAvailable == false)

  {

  result = adi_spi_IsBufferAvailable(hSPI0Device, &bAvailable);

  }

 

 

  /* fetch the transceiver buffer just processed */

  result = adi_spi_GetBuffer(hSPI0Device, &pTrans);

 

 

  /* close the SPI driver */

  result = adi_spi_Close(hSPI0Device);

 

 

    return 0;

}

Outcomes