AnsweredAssumed Answered

BF561 first PPI/DMA read is bad, correct after that

Question asked by AccuEng on Aug 27, 2012
Latest reply on Oct 1, 2013 by skassan

I am using adi_dev_ calls to setup a PPI in chained loopback mode with interrupt at the end of each buffer fill (individual chain link).  All works properly except that my first 2 words (16bit) in the receive buffer seem to be read before any frame syncs occur (bad data).  This offsets all data in the buffer by 2 words.  Thereafter, the data is read from the PPI properly.  I can work around this, but would prefer to understand why it is happening. Please help.

 

ADI_DEV_CMD_VALUE_PAIR ConfTablePPIReadStream[] = {

    { ADI_DEV_CMD_SET_DATAFLOW_METHOD,          (void *)ADI_DEV_MODE_CHAINED_LOOPBACK },

    // For receiving with 1 frame syncs (needed for PCB)

    // POLS=0, POLC=0, DLEN=111, (0's), 1 external frame sync (00),

    // non-ITU656 mode (11), receive (0), disabled (0)

    // 0011 1000 0000 1100

    //    3    8    0    C

    { ADI_PPI_CMD_SET_CONTROL_REG,              (void *)0x380C                        },

    //Delay Count of 1 works best

    { ADI_PPI_CMD_SET_DELAY_COUNT_REG,          (void *)1                             },

    { ADI_PPI_CMD_SET_TRANSFER_COUNT_REG,       (void *)0                             },

    { ADI_PPI_CMD_SET_LINES_PER_FRAME_REG,      (void *)1                             },

    { ADI_DEV_CMD_SET_STREAMING,                (void *)FALSE                         },

    { ADI_DEV_CMD_END,                          NULL                                  }

};

 

        buffer_index = 0;

        // 1-D buffers for now

        for(i=0; i<NUM_INBOUND_PPI_BUFFERS; i++)

        {

            #if BUILD_PCB == 1

            // This sets up the gSampleBuffer to be the input buffer where each DMA Buf is an

            // offset into this buffer

            InboundBufferPPI[i].Data                 = (void*)&(gSampleBuffer[buffer_index]);

            #else

            InboundBufferPPI[i].Data                 = &(InboundDataPPI[i][0]);

            #endif

            InboundBufferPPI[i].ElementCount         = NUM_PPI_ELEMENTS_RX;

            InboundBufferPPI[i].ElementWidth         = SIZE_PPI_ELEMENT_RX;

            InboundBufferPPI[i].CallbackParameter    = &(InboundBufferPPI[i]);

            InboundBufferPPI[i].ProcessedFlag        = FALSE;

            InboundBufferPPI[i].pNext                = &(InboundBufferPPI[i+1]);

            buffer_index += NUM_PPI_ELEMENTS_RX;

        }

        InboundBufferPPI[NUM_INBOUND_PPI_BUFFERS-1].pNext= NULL;

 

        // Open the PPI driver for input data

        Result = adi_dev_Open(

            DeviceManagerHandle,

            &ADIPPIEntryPoint,

            PPI_DEVICE_NUMBER,

            NULL,

            &DriverHandlePPI0,

            ADI_DEV_DIRECTION_INBOUND,

            DMAManagerHandle,

            DCBManagerHandle,

            CallbackPPI);

        ssync();

 

            Result = adi_dev_Control(

                DriverHandlePPI0,

                ADI_DEV_CMD_TABLE,

                ConfTablePPIReadStream);

    ssync();

 

        // Requeue input buffer

        InboundBufferPPI[0].ProcessedFlag = FALSE;

        Result = adi_dev_Read(

            DriverHandlePPI0,

            ADI_DEV_1D,

            (ADI_DEV_BUFFER *)&(InboundBufferPPI[0]));

        ssync();

 

        // Enable dataflow

        Result = adi_dev_Control(

            DriverHandlePPI0,

            ADI_DEV_CMD_SET_DATAFLOW,

            (void *)TRUE);

        ssync();

Outcomes