Camera image glitching/tearing when DEMO_CAMERA_BUFFER_COUNT 3

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

Camera image glitching/tearing when DEMO_CAMERA_BUFFER_COUNT 3

Jump to solution
6,094 Views
kayakaantuna
Contributor III

Hi,

 

I'm using csi_mipi_rgb_cm7 example. I customized the example for my camera, so I'm not using ov5640. With `DEMO_CAMERA_BUFFER_COUNT 2` I can get solid 20~fps with no image tearing or anything on my LVDS. But when I increased DEMO_CAMERA_BUFFER_COUNT to 3, I get full 30 fps which my camera supports, however the image see on my LVDS is like the one I attached.

 

- I get this image by memory dumping the &cameraReceivedFrameAddr, so it cannot be LVDS issue.

- And also when I increase Cortex M7 Core Root Clock higher, for example 600 MHz, more of this tearing thing happens.

 

(Note project runs on BOARD_SDRAM)

What may be the issue ?

Thanks in advance.

0 Kudos
Reply
1 Solution
5,390 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

   After internal checking, still in the SDRAM read area have limit, you can consider it is the hardware limit.

  As the semc just can connect 16bit max data length, then even your code use the 32bit read, still have read limit.

  I am thinking, your LCD resolution is smaller than the camera, why you don't change your camera solution to the same to the LCD, that may save some frame buffer.

  Normally to the SDRAM read limit, just can use the low FPS to resolve the issues, no other workaround now.

 

Best Regards,

kerry

View solution in original post

0 Kudos
Reply
28 Replies
5,391 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

   After internal checking, still in the SDRAM read area have limit, you can consider it is the hardware limit.

  As the semc just can connect 16bit max data length, then even your code use the 32bit read, still have read limit.

  I am thinking, your LCD resolution is smaller than the camera, why you don't change your camera solution to the same to the LCD, that may save some frame buffer.

  Normally to the SDRAM read limit, just can use the low FPS to resolve the issues, no other workaround now.

 

Best Regards,

kerry

0 Kudos
Reply
4,220 Views
kayakaantuna
Contributor III

Thanks @kerryzhou,

 

One last question after I close this topic... If we change our cpu to 1176 would you think it will improve our overall fps performance ?


I apperciate all of your interest about the topic. Thanks for everything


0 Kudos
Reply
4,216 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

  Yes, RT117X can improve the overal fps than other chip!

  If you have any new issues in the future, welcome to create the new case and let us know.

Best Regards,

Kerry

0 Kudos
Reply
4,818 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

   Thank you for your interest in the NXP MIMXRT product, I would like to provide service for you.

   Please tell me which board you are using? MIMXRT1170-EVK?

   Do you mean, you meet the issues like this:

kerryzhou_0-1703557546799.png

  This phenomenon is normally caused by the CPU load being high, and the refresh speed can't reach up to 30 fps. Do you enable cache or not?

 

Best Regards,

Kerry

 

 

 

0 Kudos
Reply
4,813 Views
kayakaantuna
Contributor III

Hi kerryzhou,

Thank you for your service.

I'm using our custom board, with SoC as MIMXRT1172AVM8A. 

 

  • Do you mean, you meet the issues like this:

 - Yes.

 

  • This phenomenon is normally caused by the CPU load being high, and the refresh speed can't reach up to 30 fps. Do you enable cache or not?

- Do you mean the following macro ?

`DATA_SECTION_IS_CACHEABLE=1`

 

Also I wanted to look CPU usage using JTAG, but the related documentation about the topic was only using SWD.

 

Is there any way to check CPU usage using JTAG ?

 

Thank you so much!

0 Kudos
Reply
4,808 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

  Thanks for your updated information.

  RT117x can support the JTAG directly, in your debugger connection interface, you can select the JTAG interface, it's OK to use.

  Best Regards,

kerry

0 Kudos
Reply
4,806 Views
kayakaantuna
Contributor III
Hi @kerryzhou,

No I meant I can't see the CPU usage using JTAG, and I couldn't find any documentation related to the topic.
0 Kudos
Reply
4,800 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

   JTAG information, you can find it from this linker:

https://www.nxp.com/webapp/Download?colCode=MIMXRT1170HDUG&location=null

kerryzhou_0-1703578365732.png

 

Do you meet the JTAG connection issues?

In fact, to debug the code, SWD also the same.

If you need to use JTAG, you can use it, but you need to make sure all the related JTAG pins connect to your debugger.

Best Regards,

Kerry

0 Kudos
Reply
4,798 Views
kayakaantuna
Contributor III

Hi @kerryzhou,

I can successfully debug using JTAG there is no issues about that.

https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-query-memory-and-CPU-usage/m-p/920878

As stated on the link above I want to use SWO profile for CPU Usage graphic.

But when I click on the instructions to do that I see its only for SWD. See the below link:

https://mcuoneclipse.com/2018/05/20/overview-of-mcuxpresso-ide-v10-2-0/

My question is:

- Is there a way to use "SWO profile", using JTAG ?

However, if you certain that CPU Usage is the why I'm seeing this glitching/tearing, I don't need it. If you have recommendations that can solve this issue, I rather would like to try that.

Thanks.

0 Kudos
Reply
4,795 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

  SWO is for SWD, not the JTAG.

  So, if you want to use the SWO, you need to select the SWD.

https://community.nxp.com/t5/i-MX-RT/How-using-SWO-on-RT1170-and-MIMXRT1170-EVK-board/m-p/1503886/hi...

 

Wish it helps you!

Best Regards,

Kerry

0 Kudos
Reply
4,793 Views
kayakaantuna
Contributor III
Hi @kerryzhou,

Thank you for your answer.

Regarding the issue about tearing/glithing issue on camera image. What can I do to solve it ?

Thanks

0 Kudos
Reply
4,787 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

  To the tearing/glithing issue on camera image. maybe still need to use 2 framebuffer.

 

Best Regards,

kerry

 

0 Kudos
Reply
4,781 Views
kayakaantuna
Contributor III
Hi @kerryzhou,

Thanks for your answer. If we are going to use 2 framebuffer, what else we can do to improve our camera fps ?

Few things to mention:
- We are using Optimize most(-O3)
- NonCachable allocations runs on BOARD_SDRAM

What else we can do to improve fps ? I need high fps because of camera image cropping.

Thanks
0 Kudos
Reply
4,720 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

  What's your camera resolution now? 

  Please tel me your resolution and your LCD resolution at first.

  Then, I will help you to check it whether any other way to improve.

Best Regards,

Kerry

  

0 Kudos
Reply
4,715 Views
kayakaantuna
Contributor III

Hi @kerryzhou,

 

Camera resolution = 1280x960

LCD resolution = 1280x720 (we are using RK055HDMIPI4MA0)

 

And here is the clock settings for the camera:

 

    const clock_root_config_t csi2ClockConfig = {
        .clockOff = false,
        .mux      = 2,
        .div      = 2,
    };

    /* ESC clock should be in the range of 60~80 MHz */
    const clock_root_config_t csi2EscClockConfig = {
        .clockOff = false,
        .mux      = 4,
        .div      =	3,
    };

    /* UI clock should be equal or faster than the input pixel clock.
     * The camera max resolution supported is 720*1280@30Hz, so this clock
     * should be faster than 720*1280*30 = 27.6MHz, choose 60MHz here.
     */
    const clock_root_config_t csi2UiClockConfig = {
        .clockOff = false,
        .mux      = 2,
        .div      = 2,
    };

 

 

We are using 200 MHz csi2 clock because of the serializer&deserializer.


Are there any other information that you need ?

Thanks

0 Kudos
Reply
4,621 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

  You are using the NXP MIMXRT1170-EVK board+LCD, right?

  Can you share the demo which can reproduce the issues on the NXP platform, then I will also check it.

Best Regards,

Kerry

0 Kudos
Reply
4,616 Views
kayakaantuna
Contributor III
Hi @kerryzhou,

No I'm not using EVK board as I mentioned before.

Also I'm using different camera from the example as well. So without the camera I'll reckon you couldn't reproduce the issue.

For LCD, we are using RK055HDMIPI4MA0
0 Kudos
Reply
4,602 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

  Ok, let me check it internally, any otherway to improve it.

  But, will reply you in the next week, as these days the expert is on the vocation now.

  Thanks a lot for your understanding.

  Any updated information, I will let you know.

 

Best Regards,

Kerry

0 Kudos
Reply
4,409 Views
kayakaantuna
Contributor III

Hi @kerryzhou,

 

Ok, I will be waiting for your good news.


Thanks for everything till now.

0 Kudos
Reply
4,394 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @kayakaantuna ,

   After internal discussion, seems your situation is related to the SDRAM bandwidth, normally, this situation will no other improvement methods.

   Do you try 25fps, whether that is stable or not?

  BTW, do you use the PXP to switch your CSI from 1280*960 to the LCD resolution 1280*720?

  What's the SDRAM data width you are using? 32bit in your hardware?

Best Regards,

Kerry

 

0 Kudos
Reply