Skip to main content
Explorer
October 17, 2025
Question

Why does using the STM32N6570DK to display images in PSRAM cause image tearing?

  • October 17, 2025
  • 2 replies
  • 241 views

_2-1760738839509.png

(Please ignore the green area, which is Layer 1 of the LTDC.

I am using an STM32N6570 development board with an external PSRAM (connected via XSPI1) to store camera frame buffers. I have implemented a double-buffering scheme where the DCMIPP writes camera frames into the external PSRAM buffers and the LTDC reads from them for display.

However, even with double buffering, I still observe screen tearing. I have tried:

  • Switching the LTDC display buffer only during VSync (vertical blanking)

  • Cleaning the CPU D-Cache before updating the LTDC address

Despite these measures, tearing persists. I suspect the cause is related to the limited bandwidth and high latency of the external PSRAM, combined with the LTDC FIFO prefetching. Essentially, the LTDC sometimes reads the external PSRAM while the DMA is still writing the new frame, causing partially updated frames to be displayed.

I want to find a reliable solution to eliminate screen tearing while still using the external PSRAM for camera frames.

_0-1760738564497.png

This is my XSPI1 configuration.

_1-1760738607217.png

This section is defined in SPRAM.

 void HAL_DCMIPP_PIPE_FrameEventCallback(DCMIPP_HandleTypeDef *hdcmipp, uint32_t Pipe)
 {
 frame_ready_index = num % 2;

 HAL_DCMIPP_CSI_PIPE_Start(
 hdcmipp,
 DCMIPP_PIPE1,
 DCMIPP_VIRTUAL_CHANNEL0,
 camera_framebuf[frame_ready_index],
 DCMIPP_MODE_CONTINUOUS
 );

 num++;
 NbMainFrames++;
 }



 void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc)
 {
 if(frame_ready_index != frame_to_display)
 {
 SCB_CleanDCache_by_Addr(
 (uint32_t*)camera_framebuf[frame_ready_index],
 800 * 480
 );

 HAL_LTDC_SetAddress(hltdc, camera_framebuf[frame_ready_index], 0);

 frame_to_display = frame_ready_index;
 }
 }

  I have tried using double buffering, but it couldn't resolve the issue.

 

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    October 21, 2025

    Hello @实在太懒于是不想取名 and welcome to the community;

     

    Could you please check the XSPI configuration?

    The PSRAM memory integrated in STM32N6570-DK  board is Hexadeca memory not Octo. Also the PSRAM size is 256Mb not 16 Bits.

    I recommend you to look at the XSPI_PSRAM_MemoryMapped and precisely the ioc file and check the PSRAM configuration. 

    KDJEM1_0-1761034818370.png

     

    Thank you.

    Kaouthar

     

    Technical Moderator
    November 3, 2025

    Hello @实在太懒于是不想取名 ;

     

    Any update about the issue?

    Is my reply help you to solve the tearing issue?

     

    Thank you.

    Kaouthar