cancel
Showing results for 
Search instead for 
Did you mean: 

I'm not able to use RAM_D2 section in STM32H743 as frame buffer

Svenn Dahlstrom
Associate III

Everything is working fine having the framebuffer in RAM_D1 (0x24000000).

This is what I have done trying to move my frame buffer to RAM_D2 (0x30000000):

  • I have setup the "TouchGFX_Framebuffer" in the .ld file to RAM_D2

 TouchGFX_Framebuffer :

 {

  *(TouchGFX_Framebuffer)

  *(TouchGFX_Framebuffer*)

  . = ALIGN(4);

 } >RAM_D2

  • I'm enabling RAM_D2 clock in the beginning of main()

 __HAL_RCC_D2SRAM1_CLK_ENABLE();

 __HAL_RCC_D2SRAM2_CLK_ENABLE();

 __HAL_RCC_D2SRAM3_CLK_ENABLE();

  • Configuring the MPU, setting the RAM_D2 region same as RAM_D1 region

What do I miss out for this to work?

1 ACCEPTED SOLUTION

Accepted Solutions
Svenn Dahlstrom
Associate III

This https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices pointed me to the conclusion that this is not possible.

The DMA2D can copy data from QSPI to RAM_D2 (this I can confirm from debugging) but the LTDC can not take data from RAM_D2 because there is no connection between them. And therefor using RAM_D2 for frame buffer is not possible on STM32H7. Take a look at the memory architecture below.

Is my conclusion correct?

0693W000007B7pRQAS.png

View solution in original post

10 REPLIES 10
MM..1
Chief II

Hi, you dont write how big is your buffer , but i mean 128k here is low ?

And how your TouchGFX_Framebuffer is used in code?

Svenn Dahlstrom
Associate III

Hi, my framebuffer is (320*240*3) 225KB and the RAM_D2 area is 288KB (using STM32H743ZI) so this should be enough.

From TouchGFX in TouchGFXGeneratedHAL.cpp:

namespace {
    // Use the section "TouchGFX_Framebuffer" in the linker to specify the placement of the buffer
    LOCATION_PRAGMA("TouchGFX_Framebuffer")
    uint32_t frameBuf[(320 * 240 * 3 + 3) / 4] LOCATION_ATTRIBUTE("TouchGFX_Framebuffer");
    static uint16_t lcd_int_active_line;
    static uint16_t lcd_int_porch_line;
}

MM..1
Chief II
Svenn Dahlstrom
Associate III

Thanks @MM..1 for helping out.

Yes, I have seen this and tried it but with no luck!

I do believe this is the issue here, so I think I'm not implementing this correctly.

I will do some debugging tomorrow to get more answers.

Svenn Dahlstrom
Associate III

0693W000006I1qhQAC.pngI can confirm that the RAM_D2 is working, I can read and write to the RAM_D2 area.

The frame buffer is setup to use RAM_D2 address @0x30000000.

But the screen is black, nothing is showing up on the screen...

In the linker file, this works:

TouchGFX_Framebuffer :
  {
    . = ALIGN(4);
    *(TouchGFX_Framebuffer)
  } >RAM_D1

This don't work:

TouchGFX_Framebuffer :
  {
    . = ALIGN(4);
    *(TouchGFX_Framebuffer)
  } >RAM_D2

The frame buffer contains the same data in both cases, so it seams like it's not capable to push data to display when it's in the RAM_D2 area.

Does anyone have any clue why it's not working from RAM_D2?

Is it a DMA issue her not working with RAM_D2?

MM..1
Chief II

You dont write how your LCD is connected and ... , but maybe you set new address only for TouchGFX and not hw layer. Your declaration in namespace

uint32_t frameBuf ...?

Try check in debuger how data is in framebuff and what is send to display.

Svenn Dahlstrom
Associate III

I use the STM32H743ZI on a custom board and I use parallel interface LTDC with ChromART (DMA2D), pixel format RGB888.

When I debug I can se that the LTDC frame buffer CFBADD is set to 0x30000000 (RAM_D2) and also the DMA2D memory address MA is also using the RAM_D2 (0x30000000 to 0x30038400, frame buffer size 225K).

The application is running fine (except for there is no picture on the LCD) and also if I have the application to change the screen picture I can see the RAM_D2 (0x30000000 to 0x30038400) content is changing.

Remember the only thing I have to do is change which RAM (RAM_D1 or RAM_D2) in the linker where the frame buffer (TouchGFX_Framebuffer) shall be, and using RAM_D1 it works fine!

0693W000006ICJeQAO.png0693W000006ICJPQA4.png0693W000006ICJ5QAO.png

Svenn Dahlstrom
Associate III

This https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices pointed me to the conclusion that this is not possible.

The DMA2D can copy data from QSPI to RAM_D2 (this I can confirm from debugging) but the LTDC can not take data from RAM_D2 because there is no connection between them. And therefor using RAM_D2 for frame buffer is not possible on STM32H7. Take a look at the memory architecture below.

Is my conclusion correct?

0693W000007B7pRQAS.png

Yes when isnt RAM_D2 accessible over AXI SRAM , then you have right about LTDC. Otherwise MPU is boss.