cancel
Showing results for 
Search instead for 
Did you mean: 

LTDC AF mapping bug in CubeMX code?

Tamas Novak
Associate III
Posted on December 27, 2014 at 12:10

CubeMX (CubeMX v4.3.1, STM32Cube V1.0) generated pinout for STM32F429  LTDC is

/** LTDC GPIO Configuration    

    PE4     ------> LTDC_B0

    PE5     ------> LTDC_G0

    PE6     ------> LTDC_G1

    PI9     ------> LTDC_VSYNC

    PI10     ------> LTDC_HSYNC

    PF10     ------> LTDC_DE

    PH2     ------> LTDC_R0

    PH3     ------> LTDC_R1

    PA3     ------> LTDC_B5

    PA6     ------> LTDC_G2

    PB0     ------> LTDC_R3

    PB1     ------> LTDC_R6

    PB10     ------> LTDC_G4

    PB11     ------> LTDC_G5

    PH8     ------> LTDC_R2

    PH10     ------> LTDC_R4

    PH11     ------> LTDC_R5

    PG6     ------> LTDC_R7

    PG7     ------> LTDC_CLK

    PC7     ------> LTDC_G6

    PH14     ------> LTDC_G3

    PI2     ------> LTDC_G7

    PG10     ------> LTDC_B2

    PG11     ------> LTDC_B3

    PG12     ------> LTDC_B1

    PB8     ------> LTDC_B6

    PB9     ------> LTDC_B7

    PI4     ------> LTDC_B4

    */

 

Initialization code in HAL_LTDC_MspInit() is like

    GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_6;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

    GPIO_InitStruct.Pull = GPIO_NOPULL;

    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;

    GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_10|GPIO_PIN_11 |GPIO_PIN_8|GPIO_PIN_9;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

    GPIO_InitStruct.Pull = GPIO_NOPULL;

    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;

    GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;

    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

All LTDC Alternate Functions are initialized to AF14.

Most of LTDC pins are really Alternate Function 14,

but e.g.

PB0=LCD_R3 is at AF9 instead of AF14.   AF14 is not valid for PB0 and PB1 (based on

page74 of  DocID024030 Rev 4)

It is a bug in DocID024030 Rev 4 or in  CubeMX.

2 REPLIES 2
Tamas Novak
Associate III
Posted on December 27, 2014 at 12:21

Plus one more weird thing in HAL_LTDC_MspInit(): some ports are set

GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;

and some of them are

GPIO_InitStruct.Speed = GPIO_SPEED_LOW;

I can't see any purpose for distinction. Is there any reason for that?

stm32cube-t
Senior III
Posted on January 13, 2015 at 15:47

Hello this issue will be fixed in STM32CubeMX 4.6.

The following code will be generated then (for PB0/PB1):

GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

    GPIO_InitStruct.Pull = GPIO_NOPULL;

    GPIO_InitStruct.Speed = GPIO_SPEED_LOW;

    GPIO_InitStruct.Alternate = GPIO_AF9_LTDC;

    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

Best regards