2022-11-11 03:21 AM
Hi, I have tested my 4.3" TFT-LCD by write the whole screen with one color blue or orange freshing with about 34hz, but it blinks.
the test code run in main function:
int ii=0;
int cl =0x0;//color
while(1)
{
if(ii==0)
{
ii =1;
cl =0xFF00;
}else
{
ii =0;
cl =0x00FF;
}
LTDC_Clear(cl);//change the sceens color.
HAL_Delay(30);
}
the clock of tftlcd is 10Mhz, and its resolution is 480*272, LTDC_Clear() runs DMA2D to freshing data like this:
CS_UINT32 timeout = 0;
DMA2D->CR = DMA2D_R2M; // dma2d mode: register to memory.
DMA2D->OPFCCR = DMA2D_OUTPUT_RGB565;
DMA2D->OCOLR = color;
DMA2D->OMAR = (CS_UINT32)addr;
DMA2D->OOR = offsetLine; //offset
DMA2D->NLR = (CS_UINT32)(xSize << 16) | (uint16_t)ySize;
DMA2D->CR |= DMA2D_CR_START;
while (DMA2D->CR & DMA2D_CR_START) {
timeout++;
if (timeout > 0X1FFFFF) break;
thank you.
Solved! Go to Solution.
2022-11-12 01:04 AM
OK little explain LTDC is hw for transfer pixel from framebuffer memory to LCD hw lines in RGB mode. This is based on LCD_CLK and transfer continuosly what is in memory.
DMA is hw for move data from one place to other , but no to display directly = no refresh relevant.
For sync this two hw you need implement frame interrupts. Plus timing calc...
Your code start change color without sync and info what part LTDC actualy draw...
2022-11-11 04:28 AM
Maybe you have to change the LCD Clock.
2022-11-11 07:32 AM
HAL_Delay(30);
you completely dont understand how DMA and LCD works... Tryy bigger delay
2022-11-11 04:50 PM
I tried 1000ms delay it seems work, but I need 40hz fresh rate at least. I check the LTDC guide which writes:
And total width = 523,total height = 286, so the refresh rate can reach 66.8hz when LTDC clock is 10Mhz, my tft-lcd can work between 8Mhz~12Mhz's clock.
2022-11-11 04:55 PM
the manual of my tft-lcd displayer requires its LCD clock 8Mhz~12Mhz, and I set 10Mhz. I tried to improve and lower the clock frequency it has not too much effect. And the supplier of displayer ask me to work with 10Mhz.
So could you let me know why you give me such advice?
thank you.
2022-11-11 05:00 PM
And, it should complete transmitting 2D data to LCD when DMA2D->CR 's DMA2D_CR_START is set? if so, could I begin another flushing operation immediately to wanted fresh rate?
thank you.
2022-11-12 01:04 AM
OK little explain LTDC is hw for transfer pixel from framebuffer memory to LCD hw lines in RGB mode. This is based on LCD_CLK and transfer continuosly what is in memory.
DMA is hw for move data from one place to other , but no to display directly = no refresh relevant.
For sync this two hw you need implement frame interrupts. Plus timing calc...
Your code start change color without sync and info what part LTDC actualy draw...
2022-11-12 04:28 PM
closed