2017-08-07 02:54 AM
Hello everyone,
I am attempting to relocate the frame buffer of the 'STemWin_HelloWorld' supplied with the STM32F429 Discovery kit. I would like to use the internal SRAM instead of the external SDRAM. Our project only requires 240x320 8 BPP so the SDRAM is not required.
Has anyone any experience with how to do this?
My steps so far are based on the demo code at C:\STM32Cube_FW_F4_V1.16.0\Projects\STM32F429I-Discovery\Applications\STemWin\STemWin_HelloWorld. I am running the example code on the actual Discovery kit.
I changed the &sharpdefine LCD_LAYER0_FRAME_BUFFER in LCDConf_stm32f429i_disco_MB1075.c to the address of the 112KB SRAM which is 0x2000 0000 (page 85 of en.DM00071990.pdf).
When I run the code on the debugger the program stops in the HardFault_Handler() and the call stack is indicating it failed after CUSTOM_FillRect() calls DMA2D_FillBuffer().
Any suggestions gratefully received.
Regards,
Andrew.
#sram #ltdc #stm32f429-disco #stm32f429 #sdramSolved! Go to Solution.
2017-08-09 08:35 PM
During compilation, variables are located in the SRAM area and you can not predict where the are located.
Best practise would be to allocate the frame buffer as a array, too.
uint8_t myframebuffer[320*240];
Then create a pointer
uint8_t *ptr_myframebuffer = &myframebuffer[0];
After initialisation of the LTDC with the default memory location, set the framebuffer to the array.
HAL_LTDC_SetAddress(&hltdc, (uint8_t)ptr_myframebuffer, 0);
Adjust the variable names to your needs.
You can monitor the framebuffer location with STMStudio. The value might cange with every compilation of your project.
Best regards,
Markus.
2017-08-09 08:35 PM
During compilation, variables are located in the SRAM area and you can not predict where the are located.
Best practise would be to allocate the frame buffer as a array, too.
uint8_t myframebuffer[320*240];
Then create a pointer
uint8_t *ptr_myframebuffer = &myframebuffer[0];
After initialisation of the LTDC with the default memory location, set the framebuffer to the array.
HAL_LTDC_SetAddress(&hltdc, (uint8_t)ptr_myframebuffer, 0);
Adjust the variable names to your needs.
You can monitor the framebuffer location with STMStudio. The value might cange with every compilation of your project.
Best regards,
Markus.
2017-08-16 02:25 AM
Markus,
Thank you for your reply, I have it working now. I also had to change the colour depth to L8 to avoid a hard fault when the display was turned on.
Best regards,
Andrew.
2019-07-22 04:01 AM
Andrew Stevenson,
How did you make changes to the LCDConf_stm32f429i_disco_MB1075 file? I tried the same method, but I had problems. I've changed the LCD_LAYER0_FRAME_BUFFER to 0x20000000. Can you please help me?