2021-11-02 09:09 AM
Is it possible to use STM32H743's LTDC with no frambuffer and fill its FIFO "on the fly"?
Solved! Go to Solution.
2021-11-30 07:27 AM
set 72 to 104 and when you dont see your memory isnt ready and work, Mayby you choose memory not accesible on bus with LTDC or init is bad.
Too MPU have role...
2021-11-02 10:01 AM
Maybe yes with line interrupts, but you dont fill FIFO, you set one line buffer address
2021-11-03 07:31 AM
Seemed doable until I find out that there could be only one line interrupt per frame
2021-11-03 09:06 AM
Tgfx uses more as one line int on frame to past blanking area , then i mean you can refresh on interrupt next line interrupt , but for efective i recomm use more as one line buffer.
2021-11-30 06:16 AM
Ok, I managed to do that, Im using 32 lines buffer. But I see no output from that buffer. I see background color, black rectangle where buffer output should be, but no data inside...
unsigned short framebuffer[32][1280] __attribute__((used,aligned(4),at(0x30000000)));
int main(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_LTDC_Init();
__HAL_RCC_D2SRAM1_CLK_ENABLE();
__HAL_RCC_D2SRAM2_CLK_ENABLE();
__HAL_RCC_D2SRAM3_CLK_ENABLE();
for (int line=0;line<32;line++)
{
for (int i=0;i<1280;)
{
if (line & 0x01)
{
framebuffer[line][i++] = 0x5555;
framebuffer[line][i++] = 0xAAAA;
}
else
{
framebuffer[line][i++] = 0xAAAA;
framebuffer[line][i++] = 0x5555;
}
}
}
HAL_NVIC_SetPriority(LTDC_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(LTDC_IRQn);
HAL_LTDC_ProgramLineEvent(&hltdc, 0);
while (1)
{
}
}
static void MX_LTDC_Init(void)
{
LTDC_LayerCfgTypeDef pLayerCfg = {0};
hltdc.Instance = LTDC;
hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AH;
hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AH;
hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
hltdc.Init.HorizontalSync = 19;
hltdc.Init.VerticalSync = 4;
hltdc.Init.AccumulatedHBP = 29;
hltdc.Init.AccumulatedVBP = 9;
hltdc.Init.AccumulatedActiveW = 1309;
hltdc.Init.AccumulatedActiveH = 729;
hltdc.Init.TotalWidth = 1319;
hltdc.Init.TotalHeigh = 749;
hltdc.Init.Backcolor.Blue = 0;
hltdc.Init.Backcolor.Green = 0xff;
hltdc.Init.Backcolor.Red = 0;
if (HAL_LTDC_Init(&hltdc) != HAL_OK)
{
Error_Handler();
}
pLayerCfg.WindowX0 = 0;
pLayerCfg.WindowX1 = 1280;
pLayerCfg.WindowY0 = 72;
pLayerCfg.WindowY1 = 692;
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
pLayerCfg.Alpha = 255;
pLayerCfg.Alpha0 = 255;
pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
pLayerCfg.FBStartAdress = 0x30000000;
pLayerCfg.ImageWidth = 1280;
pLayerCfg.ImageHeight = 32;
pLayerCfg.Backcolor.Blue = 0;
pLayerCfg.Backcolor.Green = 0xff;
pLayerCfg.Backcolor.Red = 0;
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
{
Error_Handler();
}
}
2021-11-30 06:48 AM
Show IRQ too and start with only 32 line test ...
pLayerCfg.WindowY0 = 72;
pLayerCfg.WindowY1 = 72+32;
2021-11-30 06:56 AM
Here is code for interrupt - no buffer or window manipulation here, just test signal output.
void LTDC_IRQHandler(void)
{
static unsigned int line_num = 10;
__HAL_LTDC_CLEAR_FLAG(&hltdc, LTDC_FLAG_LI);
__HAL_LTDC_DISABLE_IT(&hltdc, LTDC_IT_LI);
LTDC->LIPCR = line_num;
__HAL_LTDC_ENABLE_IT(&hltdc, LTDC_IT_LI);
line_num +=5;
if (line_num>=720)
line_num = 10;
LED1_GPIO_Port->ODR ^=LED1_Pin;
}
window size now is 0..1280 and 72..692. Buffer size - 32. Shouldnt I excpect buffer output at line 72 to 104?
2021-11-30 07:14 AM
Hmm lines is numbered with porch and irq on 0 maybe isnt good choice.
Inspire from touchgfx code
lcd_int_active_line = (LTDC->BPCR & 0x7FF) - 1;
lcd_int_porch_line = (LTDC->AWCR & 0x7FF) - 1;
2021-11-30 07:19 AM
I disabled interrupt for now. My goal is to see the buffer on the screen...
2021-11-30 07:23 AM
Trry explain for what you plan this because i dont see real use.