RT1020 FlexIO Camera Demo - DMA Speed

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

RT1020 FlexIO Camera Demo - DMA Speed

Jump to solution
1,622 Views
variable_andrew
Senior Contributor I

I've modified the RT1020 camera demo to interrupt on every horizontal instead of every frame. 

Even if I don't save all my data, and just put a simple row counter to count the number of interrupts I get, it appears that I don't get every row. 

Ie - I set the sensor up to send 432 rows of 768 pixels per frame. 

I see on the DLA, that the expected data is being sent to the RT1021. 

But the RT1021 only gets around 135 to 280 of these row interrupts. 


Here is the only code happening in the DMA ISR:


void FLEXIO_StartNewLine(void) {
    if (rowIndex >= AS0330_FRAME_HEIGHT){
        //reset "row index" - really becoming mod_row
        rowIndex = 0;

        //update DMA pointer to start of rx buffer
        DMA0->TCD[FLEXIO_CAMERA_DMA_CHN].DADDR = (uint32_t)pFlexioCameraFrameBuffer;
    }
    /* Enable DMA channel request. */
    DMA0->SERQ = DMA_SERQ_SERQ(FLEXIO_CAMERA_DMA_CHN);
}

void FLEXIO_EndLine(void) {
    FLEXIO_CAMERA_ClearStatusFlags(&s_FlexioCameraDevice, kFLEXIO_CAMERA_RxDataRegFullFlag | kFLEXIO_CAMERA_RxErrorFlag);
    if (frameIndex < 1000){
        linesPerFrame[frameIndex]++;
    }
    rowIndex++;
    totalFrameRowIndex++;

}

 

I see every frame has the same # of rows (sometimes the 1st frame has one less).

As the code is "working" (getting the row interrupts, etc), just missing a weird number of the rows, it almost seems like the DMA isn't fast enough to process the FlexIO data with interrupts?

While I'm basing my code off the RT1020 Flexio Camera demo - I used the standard SDK project's clock config from MCUXpresso w/ just the flexIO regs updated (I didn't see anything DMA specific) . 

Is the default MCUXpresso SDK (2.6.1) clock setup w/r/t DMA not adequate for pixel data speeds?

Labels (1)
Tags (2)
1 Solution
1,317 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi variable_andrew,

  Thanks a lot for your detail frequency information.

  Today, I help you to check your question with our CSI expert, he told me that:  Your 49Mhz is too high, and the FlexIO can't support it, from theory, the PCLK can support upto 20Mhz, so maybe you can try 20Mhz or smaller case.

  If you still have questions about it, please kindly let me know.


Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

9 Replies
1,317 Views
variable_andrew
Senior Contributor I

any thoughts? 

maybe Hui_Ma or others?

0 Kudos
1,317 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi variable_andrew,

  Sorry for our later reply, because a lot of cases in the queue.

  I will help you to check it from our internal side, please keep patient, any updated information, I will let you know.

  Thanks a lot for your understanding.

Kerry

1,317 Views
variable_andrew
Senior Contributor I

After looking thru the clock code - it appears that eDMA is set to run at 500MHz and the FlexIO is set (same as the demo) to run at 120MHz, and according to the clock config tool - it appears this might be where the FlexIO maxes out?

Can you confirm? 

Also - let me know about any other ideas for missed data from the FlexIO/DMA?

(side question: at what point are you able to post w/o needing moderation for every single post?)

0 Kudos
1,317 Views
variable_andrew
Senior Contributor I

By slowing down the camera to an extremely slow pixel-rate, FlexIO was able to keep up without dropping any rows in a frame. 

Since by slowing down the FlexIO trigger for the timers - this works - does that mean the FlexIO isn't fast enough to keep up with the camera? (FlexIO maxed at 120MHz). 

Is the timer for FlexIO running on the flexIO clock or something else? Would speeding that up help?

0 Kudos
1,317 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi variable_andrew,

    Sorry for my later reply.

    You said, when your slow down the camera to an extremely slow pixel-rate, then the FlexIO without dropping the data. Could you tell me the detail pixel-rate?  What's the pixel-rate you will meet the data drop problems?

Best Regards,

Kerry

0 Kudos
1,317 Views
variable_andrew
Senior Contributor I

Hi kerryzhou‌, 

I have a camera that provides 2304 pixels by 1296 rows for a single frame. 

This - at any slowed data rate, seems impossible for the RT1021, so I've subdivided rows and pixels by 3, so we have:

432 rows of 768 pixels. 

A single pixel is 12 bits. 

In order for the RT1021 to actually capture all the data via FlexIO (set to 120MHz), using DMA with major loop set to a single row. 

The default pixel clk rate is 49MHz - frame time/ row time is shown in the imgs below:

def frame valid time - 25ms

default_frame_rate.png

default line (row) valid time (18us):

default_row_rate.png

To get this to work, I had to update the camera's pixel clk to 9 MHz - here is the current captures w/ all the pixels getting captured:

Frame valid time - 0.97 seconds..

Screen Shot 2019-10-24 at 11.06.25 AM.png line (row) valid time (0.1ms with time between rows going from 61us to 2.24ms ):

Screen Shot 2019-10-24 at 11.06.56 AM.png

0 Kudos
1,318 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi variable_andrew,

  Thanks a lot for your detail frequency information.

  Today, I help you to check your question with our CSI expert, he told me that:  Your 49Mhz is too high, and the FlexIO can't support it, from theory, the PCLK can support upto 20Mhz, so maybe you can try 20Mhz or smaller case.

  If you still have questions about it, please kindly let me know.


Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,317 Views
variable_andrew
Senior Contributor I

got it - thanks kerryzhou

0 Kudos
1,317 Views
kerryzhou
NXP TechSupport
NXP TechSupport

You are welcome!

 If you have the new question in the future, welcome to create the new question post.

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos