AnsweredAssumed Answered

PPI frame synchronisation

Question asked by max64 on May 20, 2011
Latest reply on May 20, 2011 by max64

I'm trying to capture a single frame from an image sensor which is free running. I believe I'm following the required steps of:

1) ensuring PPI is not running

2) initialising DMA for one-shot

3) enabling DMA

4) enabling PPI

 

But when I run the code, I nearly always get VSYNC misalignment (HSYNC is fine). And the FT_ERR flag in PPI0_STATUS unsurprisingly indicates a framing error.

 

Can anyone offer advice?

 

 

void MT9T031_get_frame(void * dma_buf)
{
     // disable PPI
     *pPPI0_CONTROL &= ~PPIEN;
     ssync();

     // Initialise DMA1_0
     while (*pDMA1_0_IRQ_STATUS & DMA_RUN) {
          // wait until DMA complete
          if (*pDMA1_0_IRQ_STATUS & DMA_DONE)
          break;
     };

     // clear DONE status
     *pDMA1_0_IRQ_STATUS = DMA_DONE;

     // configure MMR registers for DMA1 channel 0
     *pDMA1_0_CONFIG = DI_EN | RESTART | DMA2D | WDSIZE_16 | WNR;
     *pDMA1_0_START_ADDR = dma_buf;
     *pDMA1_0_X_COUNT = ACTIVE_COLUMNS;
     *pDMA1_0_X_MODIFY = sizeof(unsigned short);
     *pDMA1_0_Y_COUNT = ACTIVE_ROWS;
     *pDMA1_0_Y_MODIFY = sizeof(unsigned short);
     ssync();

     // kick-off one-shot DMA
     *pDMA1_0_CONFIG |= DMAEN;
     ssync();

     // enable PPI
     *pPPI0_CONTROL |= PPIEN;
     ssync();
}

 

Regards,

Peter

Outcomes