AnsweredAssumed Answered

STM32Cube Bug Report - LTDC

Question asked by denisov.alex on Jan 26, 2015
Latest reply on Mar 4, 2015 by Montassar BEN ROMDHANE
When displaying partial regions of a bitmap in a layer or when implementing layers that are partially off screen, it is important to be able to assign different values to the frame buffer pitch and the line length. Setting only WindowX/Y/0/1 parameters is not enough.

According to documentation, the lower 12 bits of CFBLR are defined as line length+3 this is not the same as frame buffer pitch. The current implementation (as of V1.2.0), is using pLayerCfg->ImageWidth to populate both fields within the CFBLR register which does not allow to specify individual values thus limiting the possible usage of layers in LTDC controller.

Bug location: stm32f4xx_hal_ltdc.c (V1.2.0), implementation of LTDC_SetConfig, line #1166

Suggested fix: 

Replace:
LTDC_LAYER(hltdc, LayerIdx)->CFBLR  = (((pLayerCfg->ImageWidth * tmp) << 16) | ((pLayerCfg->ImageWidth * tmp)  + 3));

With:
LTDC_LAYER(hltdc, LayerIdx)->CFBLR  = (((pLayerCfg->ImageWidth * tmp) << 16) | (((pLayerCfg->WindowX1 - pLayerCfg->WindowX0) * tmp)  + 3));

Outcomes