AnsweredAssumed Answered

[Bug] STM32F469I-Discovery BSP: LCD Orientation

Question asked by tfl on Mar 11, 2016
Latest reply on Mar 29, 2016 by Amel N

By default, if one uses the BSP_LCD_Init() function provided by the library "stm32469i_discovery_lcd.h" to set up the LCD screen of an STM32469I-Discovery board, the screen orientation will be landscape. If one wants to change it to portrait instead, he or she will have to use BSP_LCD_InitEx(LCD_ORIENTATION_PORTRAIT) but unfortunately that does not work and all you will get is a blank screen because there is a bug in said function.

As it turns out, some settings within the function were mixed up. The following is the corrected version which fixes everything and finally gives users the ability to switch to a portrait orientation. The problem can be found beginning from line 252 of the source code "stm32469i_discovery_lcd.c".

/* Timing parameters for all Video modes
 * Set Timing parameters of LTDC depending on its chosen orientation
 */
if(orientation == LCD_ORIENTATION_PORTRAIT)
{
  VSA  = OTM8009A_480X800_HSYNC;    //Originally OTM8009A_480X800_VSYNC;
  VBP  = OTM8009A_480X800_HBP;      //Originally OTM8009A_480X800_VBP;
  VFP  = OTM8009A_480X800_HFP;      //Originally OTM8009A_480X800_VFP;
  HSA  = OTM8009A_480X800_VSYNC;    //Originally OTM8009A_480X800_HSYNC;
  HBP  = OTM8009A_480X800_VBP;      //Originally OTM8009A_480X800_HBP;
  HFP  = OTM8009A_480X800_VFP;      //Originally OTM8009A_480X800_HFP;
  lcd_x_size = OTM8009A_480X800_WIDTH;  /* 480 */
  lcd_y_size = OTM8009A_480X800_HEIGHT; /* 800 */                               
}
else
{
  /* lcd_orientation == LCD_ORIENTATION_LANDSCAPE */
  VSA  = OTM8009A_800X480_VSYNC;        /* 12 */
  VBP  = OTM8009A_800X480_VBP;          /* 12 */
  VFP  = OTM8009A_800X480_VFP;          /* 12 */
  HSA  = OTM8009A_800X480_HSYNC;        /* 120 */
  HBP  = OTM8009A_800X480_HBP;          /* 120 */
  HFP  = OTM8009A_800X480_HFP;          /* 120 */
  lcd_x_size = OTM8009A_800X480_WIDTH;  /* 800 */
  lcd_y_size = OTM8009A_800X480_HEIGHT; /* 480 */                               
}

P.S. Tested with STM32CubeF4 v.1.11.0

Outcomes