AnsweredAssumed Answered

BF 533 SPORT with external clock

Question asked by leni on Feb 16, 2016
Latest reply on Apr 6, 2016 by Jithul_Janardhanan

Hi,

I'm trying to transmit via SPORT interface. I am using the EZKIT LITE Evaluation Board of the DSP BF-533.

It works fine as long as I am using internal clock, but as I want to use external clock in the end, I am trying to change this.

But with external clock the data is not transmitted. The buffers are filled but not send.

 

Is there anything wrong with my parameters?

 

This is a minimum example of my code. I connected a pulse generator as clock signal (at different frequencies from 29.7MHz to 59.4Mhz as I was not sure about the maximum possible frequency) with a 50% duty cycle.

 

#include "adi_initialize.h"

#include <drivers/sport/adi_sport.h>

#include <stdio.h>

#include <string.h>

#include <errno.h>

#include "sysreg.h"

#include <assert.h>

#include <cdefBF533.h> // BF533 Register Pointer Definitions

 

#define SIZE_OF_TX_BUFFER 1024

 

/* flag indicating if SPORT processing is complete */

bool bBufferComplete = false;

int dataReady = 0;

/* SPORT driver memory */

uint8_t DeviceMemory[ADI_SPORT_DMA_MEMORY_SIZE];

/* Tx buffers-0 */

uint8_t nBufferTx0[SIZE_OF_TX_BUFFER];

/* Tx buffers-1 */

uint8_t nBufferTx1[SIZE_OF_TX_BUFFER];

 

 

void fillBuffer(uint8_t * buffer){

    buffer = malloc(SIZE_OF_TX_BUFFER * sizeof(uint8_t));

    for(int i = 0; i<SIZE_OF_TX_BUFFER; i++){

        buffer[i]=i;

    }

}

 

int main(void)

{

     adi_initComponents();

 

    sysreg_write(reg_SYSCFG, 0x32);

    csync();

    ssync();

    /* SPORT driver handle */

    ADI_SPORT_HANDLE hDevice;

 

    /* driver API result code */

    ADI_SPORT_RESULT  eResult;

 

    void *pProcessedBuffer;

 

    /* open the SPORT driver */

    eResult = adi_sport_Open(1,ADI_SPORT_DIR_TX, ADI_SPORT_SERIAL_MODE, DeviceMemory,ADI_SPORT_DMA_MEMORY_SIZE,&hDevice);

 

    // Use the driver API's to configure SPORT

    eResult = adi_sport_ConfigData(hDevice,ADI_SPORT_DTYPE_ZERO_FILL,false,15);

    eResult = adi_sport_ConfigClock(hDevice,1u,false,true);

    eResult = adi_sport_ConfigFrameSync(hDevice,15u,true,true,false,false,true);

 

    /* Enable the DMA mode */

    eResult =  adi_sport_EnableDMAMode(hDevice,true);

 

    /* submit the first  buffers */

    eResult = adi_sport_SubmitBuffer(hDevice,nBufferTx0,SIZE_OF_TX_BUFFER);

    /* submit the second buffer  */

    eResult = adi_sport_SubmitBuffer(hDevice,nBufferTx1,SIZE_OF_TX_BUFFER);

    /* Enable the device */

    eResult = adi_sport_Enable(hDevice,true);

 

 

 

    while(dataReady < 10)

    {

          eResult = adi_sport_IsBufferAvailable(hDevice,&bBufferComplete);

        if(bBufferComplete == true){

   

             eResult = adi_sport_GetBuffer(hDevice,&pProcessedBuffer);

             fillBuffer((uint8_t*)pProcessedBuffer);

             eResult = adi_sport_SubmitBuffer(hDevice,pProcessedBuffer,SIZE_OF_TX_BUFFER);

             bBufferComplete = false;

             dataReady++;

 

        }

    }

 

    while(*pSPORT1_STAT & TXF){

        //wait till last bit is send

        printf("wait...\n");

    }

 

    /* Disable the device */

    eResult = adi_sport_Enable(hDevice,false);

 

    /* close the SPORT driver */

    eResult = adi_sport_Close(hDevice);

 

    return 0;

}

 

What happens is that I get stuck in a SportStatusHandler function in an endless loop as the buffers are never send.

Thanks for your help!

Outcomes