can i get interrupt when DMA transfer done when one frame received?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

can i get interrupt when DMA transfer done when one frame received?

773 Views
nileshravaliya
Contributor II

i have integrate image sensor  with TWRK80 board using flexio DMA transfer. My image sensor resolution is 640*480

total 307200 bytes received. so i have confusion about interrupt when full frame received i  want interrupt in DMA transfer done. please help me out of this   

FLEXIO_Ov7670StartCapture(1); used for capture start

FLEXIO_Ov7670StartCapture(0);  for capture stop

3 Replies

632 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Nilesh,

I don't know where 'FLEXIO_Ov7670StartCapture' comes from, so I only say something about EDMA and OV7670 base on AN5275(you can download it from NXP website).
I think there are 2 signals which you can use to generate frame interrupt. First is VSYNC. It is generated when a frame end. You can use it to generate interrupt. Please see the hardware_init.c line 118(in an5275sw). The other signal is from EDMA. Driver use EDMA channel3 to restore eDMA channel 17 iteation count(CITER) to synchronize with frame at VSYNC edge. It also can generate interrupt.

Regards,

Jing

0 Kudos

632 Views
nileshravaliya
Contributor II

Hi jingpan,

I know that vsync generates two times, first is start of frame and second is end of frame meanwhile two time vsync pulse generates for one frame am I right ??

I have added below code for vsync interrupt till I am getting image data slightly shift from left side as attached image.

How to moniter CITER value in debug ?

Void main()

{

stop=1;

start=0;

while (1)

{

while(stop)

{

FLEXIO_Ov7670StartCapture(1);

}

Stop=1; // again start capture

}

}

void BOARD_VSYNC_IRQHandler(void)

{

PORT_Type *portBase[] = PORT_BASE_PTRS;

PORT_ClearPinsInterruptFlags(portBase[BOARD_VSYNC_PORT_INDEX], 1U << BOARD_VSYNC_PIN_INDEX);

// printf("v pulse\n");

FLEXIO_Ov7670AsynCallback();

}

void FLEXIO_Ov7670StartCapture(uint8_t bufferIndex)

{

s_FlexioStartCapture = bufferIndex;

}

void FLEXIO_Ov7670AsynCallback(void)

{

FLEXIO_CAMERA_ClearStatusFlags(&s_FlexioCameraDevice,

kFLEXIO_CAMERA_RxDataRegFullFlag | kFLEXIO_CAMERA_RxErrorFlag);

FLEXIO_CAMERA_EnableRxDMA(&s_FlexioCameraDevice, false);

if (s_FlexioStartCapture > 0 && start<10)

{

start=start+1;

/* Reset the EDMA source, dest address and transfer counter to sync picture frame */

DMA0->TCD[FLEXIO_DMA_CHANNEL].SADDR = FLEXIO_CAMERA_GetRxBufferAddress(&s_FlexioCameraDevice);

DMA0->TCD[FLEXIO_DMA_CHANNEL].DADDR = (uint32_t)&g_FlexioCameraFrameBuffer[0][0];

DMA0->TCD[FLEXIO_DMA_CHANNEL].CITER_ELINKNO = ((OV7670_FRAME_BYTES >> 5));//00000010010110000000

DMA0->TCD[FLEXIO_DMA_CHANNEL].BITER_ELINKNO = ((OV7670_FRAME_BYTES >> 5));

FLEXIO_CAMERA_EnableRxDMA(&s_FlexioCameraDevice, true);

s_FlexioStartCapture = 0;

}

else

{

stop=0;

s_FlexioStartCapture = 0;

}

}

Regards with

Nilesh Ravaliya

8980035565

Access Computech Pvt. Ltd.

0 Kudos

632 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Nilesh,


CITER is the counter of major loop. The minor loop is the sequence of read-write operations that transfers these NBYTES per service request, for example, 32 byte video data(flexIO buffer size). Each service request executes one iteration of the major loop, which transfers NBYTES of data, for example, a full 640x480/32 minor loop data. When mojor loop count complete, TCDn_CSR[DONE] will be set. If TCDn_CSR[INTMAJOR]==1, interrupt is generated.

As to the VSYNC, from the OV7670 spec, I get that one frame should have one VSYNC.

Regards,

Jing