cancel
Showing results for 
Search instead for 
Did you mean: 

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

_2-1760738839509.pngPlease 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.

 

0 REPLIES 0