2018-07-31 03:56 AM
Im using STM32F746GDISCO board and on-board SDRAM.
I configured sdram initialization at startup and modify the linker file accordingly. I have 2 framebuffers located at 0xC0000000 and 0xC0400000 because ST recommends to use 2 banks for 2 framebufers. LTDC framebuffer address changes like below code:
LTDC_Layer1->CFBAR = (uint32_t) framebuffer1;
LTDC->SRCR = 2UL;
while(!(LTDC->CDSR & 4UL));
while(LTDC->CDSR & 4UL);
Systick_Delay_X10us(100000);
LTDC_Layer1->CFBAR = (uint32_t) framebuffer2;
LTDC->SRCR = 2UL;
while(!(LTDC->CDSR & 4UL));
while(LTDC->CDSR & 4UL);
Systick_Delay_X10us(100000);
Framebuffer1 is full of BLUE and framebuffer2 is full of RED pixels. After i start the debug i see nothing but a dark screen. But when i push restart button of TrueStudio one of the framebuffers are displayed on the screen (red or blue) a little distorted. As soon as i press again resume button display shows perfect RED or BLUE according to which was printed when restarted. So i started to debug line by line to watch LTDC framebuffer address. LTDC framebuffer address changes when the address change line comes in but display doesn't show this framebuffer.
At first debug (i mean having no restart) display shows black screen. In order to have a RED or BLUE, i must restart the debug session. What does causes this problem and how can i fix this issue?
I defined my framebuffers and addresses as below:
typedef struct
{
uint32_t frame[65280];
} framebuffertype;
#define sdram_base 0xC0000000U
#define framebuffer1 ((framebuffertype*) sdram_base)
#define framebuffer2 ((framebuffertype*) (sdram_base + 1024*1024*4))
for(uint32_t i = 0; i<65280; i++)
{
framebuffer1->frame[i]= 0x001F001F;
}
for(uint32_t i = 0; i<65280; i++)
{
framebuffer2->frame[i] = 0xF800F800;
}
2018-08-01 12:58 PM
OK, the problem has been fixed.