AnsweredAssumed Answered

BF561 PPI0 Question

Question asked by EdHopkins on Jan 16, 2012
Latest reply on Feb 21, 2012 by gyi

Am trying to set up the PPI0 port on the BF561 (just on core A for now).  The following code is a first attempt at configuring the port using the device driver API.  I would expect to see data coming out the 16 bit wide data bus, but the scope shows them holding (not toggling at all).  I want to set up something that will change so I can prove that the data is coming out to the scope.  Any idea what is missing?  Right now the pins are fixed to some arbitrary value that I do not expect based on following code.

 

Thanks!

 

 

 

   for(i=0; i<NUM_INBOUND_PPI_BUFFERS; i++)
    {
        InboundBufferPPI[i].Data                 = &InboundDataPPI[i][0];
        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                = NULL;
    }
    InboundBufferPPI[NUM_INBOUND_PPI_BUFFERS-1].pNext= NULL;
    for(i=0; i<NUM_OUTBOUND_PPI_BUFFERS; i++)
    {
        OutboundBufferPPI[i].Data                = &OutboundDataPPI[i][0];
        OutboundBufferPPI[i].ElementCount        = NUM_PPI_ELEMENTS_TX;
        OutboundBufferPPI[i].ElementWidth        = SIZE_PPI_ELEMENT_TX;
        OutboundBufferPPI[i].CallbackParameter   = NULL;
        OutboundBufferPPI[i].ProcessedFlag       = FALSE;
        OutboundBufferPPI[i].pNext               = NULL;
    }
    OutboundBufferPPI[NUM_OUTBOUND_PPI_BUFFERS-1].pNext= NULL;
    // Copy ctrl registers to PPI out buffer
    for(i=0; i<BUFFER_SIZE_PPI_TX; i++)
    {
        OutboundDataPPI[0][i] = sADCCtrlRegs[i];
    }

    // Configuration table for the PPI driver using DMA mode
    // Control register from Analog app note AN-813, p. 7
    ADI_DEV_CMD_VALUE_PAIR ConfTablePPI[] = {
        { ADI_DEV_CMD_SET_DATAFLOW_METHOD,      (void *)ADI_DEV_MODE_CHAINED    },
        { ADI_PPI_CMD_SET_CONTROL_REG,          (void *)0x780E                  },
        { ADI_DEV_CMD_END,                      NULL                            }
    };

    // Open the PPI driver for output data flow initially
    Result = adi_dev_Open(
        DeviceManagerHandle,
        &ADIPPIEntryPoint,
        PPI_DEVICE_NUMBER,
        NULL,
        &DriverHandlePPI0,
        //ADI_DEV_DIRECTION_INBOUND,  // Can only be one direction at a time
        ADI_DEV_DIRECTION_OUTBOUND,
        DMAManagerHandle,
        DCBManagerHandle,
        CallbackPPI);
    if( Result != ADI_DEV_RESULT_SUCCESS )
    {
  // Todo: handle error properly

  // For now exit while loop and shutdown
  gRunning = 0;
    }

    // configure the PPI driver with the values from the configuration table
    Result = adi_dev_Control(
        DriverHandlePPI0,
        ADI_DEV_CMD_TABLE,
        ConfTablePPI);
    if( Result != ADI_DEV_RESULT_SUCCESS )
    {
  // Todo: handle error properly

  // For now exit while loop and shutdown
  gRunning = 0;
    }

    // submit outbound buffer
    Result = adi_dev_Write(
        DriverHandlePPI0,
        ADI_DEV_1D,
        (ADI_DEV_BUFFER *)&OutboundBufferPPI[0]);
    if( Result != ADI_DEV_RESULT_SUCCESS )
    {
  // Todo: handle error properly

  // For now exit while loop and shutdown
  gRunning = 0;
    }

    Result = adi_dev_Control(
  DriverHandlePPI0,
  ADI_DEV_CMD_SET_DATAFLOW,
  (void *)TRUE);
    if( Result != ADI_DEV_RESULT_SUCCESS )
    {
  // Todo: handle error properly

  // For now exit while loop and shutdown
  gRunning = 0;
    }

    // Wait for PPI to complete
    for( i=0; i<0x2fff; i++ );

    Result = adi_dev_Control(
  DriverHandlePPI0,
  ADI_DEV_CMD_SET_DATAFLOW,
  (void *)FALSE);
    if( Result != ADI_DEV_RESULT_SUCCESS )
    {
  // Todo: handle error properly

  // For now exit while loop and shutdown
  gRunning = 0;
    }

Outcomes