AnsweredAssumed Answered

Reading from PPI causes Ezkit to reset

Question asked by d3g8q9 on Dec 22, 2011
Latest reply on Jan 18, 2012 by d3g8q9

Hi,

 

I'm working on a project where I need to receive ADC readings over the PPI interface.  I've been having difficulties with reading more than 30 words (I need to read about 2500).  I'm using the BF-537.

 

I've moved back to the Ezkit Lite to try out some things, and found that the Ezkit resets after I start a PPI read.  As I've never reflashed my Ezkit I can see that it's reset because the LEDs do their cycling pattern.

 

I'm working within a VDK environment, I've configured GP Timer 5 as a PWM at 1.2 MHz, and connected it to the PPI0CLK.  I know that this is working because I can see it on the scope.

 

My source code is below

 

#define PPI_BUFFER_SIZE 35

static ADI_DEV_DEVICE_HANDLE    hPPIHandle;

static u16 ppiDataBuffer[PPI_BUFFER_SIZE];

static ADI_DEV_1D_BUFFER PpiInboundBuffer;

static void PpiCallback(

    void    *pAppHandle,

    u32     nEvent,

    void    *pArg

){

 

    /* CASEOF (event type) */

    switch (nEvent)

    {

        /* CASE (buffer processed) */

        case ADI_DEV_EVENT_BUFFER_PROCESSED:

// A transmit has completed

VDK_C_ISR_PostSemaphore(kPPISem); // update transfer completed semaphore

adi_dev_Control(hPPIHandle, ADI_DEV_CMD_SET_DATAFLOW, (void *)FALSE);

            break;

        default:

        lastIntStatus = nEvent;

        break;

    }

 

    /* return */

}

static void ppiInit(void)
{
    u32 nResult;
    ADI_DEV_CMD_VALUE_PAIR PPIConfig[] =
    {
          //BJB-- the following selects 0 Frame Syncs
          { ADI_PPI_CMD_SET_CONTROL_REG,               (void *)0x387C                         }, /* 16 bit data, internal trigger, , 0FS, input, non-ITU mode */
          { ADI_DEV_CMD_SET_DATAFLOW_METHOD,          (void *)ADI_DEV_MODE_CHAINED     }, /* chained method    */
          { ADI_DEV_CMD_END,                              NULL                                   }
    }; 
   
    /* Open Ppi */
    if(nResult = adi_dev_Open(
                              adi_dev_ManagerHandle,
                              &ADIPPIEntryPoint,
                              0,
                              0,
                              &hPPIHandle,
                              ADI_DEV_DIRECTION_INBOUND,
                              adi_dma_ManagerHandle,
                              NULL,
                              PpiCallback
                              )!=ADI_DEV_RESULT_SUCCESS)
    {
        DriverError("PPI_Open", nResult);
    }
   
    /* set config table */
    if(nResult = adi_dev_Control(
                                hPPIHandle,
                                ADI_DEV_CMD_TABLE,
                                PPIConfig
                                )!= ADI_DEV_RESULT_SUCCESS)
    {
        DriverError("PPI_Cfg", nResult);
    }
    return;
}
/*********************************************************************
    Function:       Configure Ppi Buffers
                    configures the inbound and outbound buffers
                    configures callback on inbound buffer
    Description:   
*********************************************************************/
static void ppiRead(void)
{
    u32 nResult;
   
     memset(ppiDataBuffer, 0, PPI_BUFFER_SIZE);
     PpiInboundBuffer.Data                = &ppiDataBuffer[0];
     PpiInboundBuffer.ElementCount        = PPI_BUFFER_SIZE-1;
     PpiInboundBuffer.ElementWidth        = 2;
     PpiInboundBuffer.CallbackParameter   = NULL;
     PpiInboundBuffer.ProcessedFlag       = FALSE;
     PpiInboundBuffer.pNext               = NULL;
/* Submit inbound buffer */
    if(nResult = adi_dev_Read(
                              hPPIHandle,
                              ADI_DEV_1D,
                              (ADI_DEV_BUFFER *)&PpiInboundBuffer
                              )!= ADI_DEV_RESULT_SUCCESS)
    {
        DriverError("PPI_read", nResult);
    }
    /* Enable dataflow */
    if(nResult = adi_dev_Control(
                                hPPIHandle,
                                ADI_DEV_CMD_SET_DATAFLOW,
                                (void *)TRUE
                                )!= ADI_DEV_RESULT_SUCCESS)
    {
        DriverError("DataFlow", nResult);
    }
}

 

void testPpi(void)

{

ppiInit();

ppiRead();

 

     while(PpiInboundBuffer.ProcessedFlag == FALSE);

 

     //I never get here!!  

    debug_print(threadIdList.debugThreadId, "PPI test complete\n");

}

Outcomes