Skip to main content
terter etuet
Associate II
March 16, 2017
Question

stm32f769-Disco stm32cubemx configuration for LCD

  • March 16, 2017
  • 3 replies
  • 1551 views
Posted on March 16, 2017 at 13:19

Hello,

i am trying to use stm32cubemx for a stm32f769-disco board, got a blinky to run with rtos,

but now how do i configure stm32cubemx to get the lcd/touch initialized/running? many thanks for any help!

terter
    This topic has been closed for replies.

    3 replies

    john doe
    Senior III
    March 17, 2017
    Posted on March 17, 2017 at 01:27

    1) in your project's Drivers directory make one named BSP

    2) in the BSP directory make a directory named STM32F769I-Discovery and a directory named Components

    3) copy the board support package from STM32Cube/Repository/STM32Cube_FW_F7_V1.6.0/Drivers/BSP/STM32F769I-Discovery

    copy the .h and the .c files for

    stm32f769i_discovery

    stm32f769i_discovery_lcd

    stm32f769i_discovery_sdram

    stm32f769i_discovery_ts

    copy them into your project's Drivers/BSP/STM32F769I-Discovery directory you made in step 2

    4) copy the hardware drivers from STM32Cube/Repository/STM32Cube_FW_F7_V1.6.0/Drivers/BSP/Components

    the lcd is an otm8009a so copy the whole directory otm8009a into your project's Drivers/BSP/Components directory

    the touch sensor uses the ft6x06 driver so copy that directory as well

    either copy the code for the adv7533 or comment it out of stm32f769i_discovery_lcd.h - if you use the hdmi adapter board and not the lcd, thats what this is for

    5) add Drivers/BSP/STM32F769I-Discovery to your includes path.

    if you're using SW4STM32, select your project, choose properties, c/c++ build, settings, includes

    6) add the #includes to your project after the USER CODE BEGIN includes comment

    #include 'stm32f769i_discovery.h'

    #include 'stm32f769i_discovery_lcd.h'

    #include 'stm32f769i_discovery_sdram.h'

    #include 'stm32f769i_discovery_ts.h'                                                              

    7) make a directory at the top level of your project called Utilities, and make a directory inside it called Fonts

    8) copy the fonts from STM32Cube/Repository/STM32Cube_FW_F7_V1.6.0/Utilities/Fonts into your Fonts directory

    9) add the initialization calls to your project

    uint8_t lcd_status = LCD_OK;

    BSP_LCD_Init();

    while(lcd_status != LCD_OK);

    uint32_t ts_status = TS_OK;

    ts_status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize());

    that should at least get a person going.

    Log in the STM32Cube/Repository/STM32Cube_FW_F7_V1.6.0/Utilities/Log directory is also worth exploring

    on edit: i forgot about the rest of the hal drivers

    if you didnt add them in stm32cubemx, you'll need to add the hal drivers for

    dma2d

    dsi

    ltdc and ltdc_ex

    sdram

    stm32f7xx_ll_fmc

    copy them from STM32Cube/Repository/STM32Cube_FW_F7_V1.6.0/Drivers/STM32F7xx_HAL_Driver/ into the corresponding Drivers/STM32F7xx_HAL_Driver/ of your project and enable the modules in your project's stm32f7xx_hal_conf.h

    terter etuet
    Associate II
    March 18, 2017
    Posted on March 18, 2017 at 16:36

    Thank You so much,

    i putted all the things together, to get it compiled i had to exclude the /Utilities/Fonts directory from build (would give multiple references to fontsXX.o)

    and add the BSP/Components/Common directory

    when i run it the backlite of the lcd is switched on but

      BSP_LCD_Clear(LCD_COLOR_LIGHTGREEN);

    changes nothing and it crashes writing:

      BSP_LCD_DisplayStringAtLine(8, (uint8_t*)'testttest42');

    could there be a problem with the initializion from the stm32cubemx?

    Initialize all peripherals with their default mode is checked

    DMA2D is activated

    DSIHost is set to Adapted command mode with TE Pin

    SDRAM1 SDCKE0+SDNE0

    4 Banks 13bit Addesses 32 Bit Data

    LTDC is set to RGB888 DSI-Mode

    HCLK is 192MHz

    PLL DSI gives 250MHz      set back to default 500MHz, no change

    DSI txclkesc is 7.8125 MHz set back to default 15.625Mhz, no change

    DSI Lane Byte 31.25 MHz set back to default 62.5Mhz, no change

    Configuration:

    DSI-Host is set according to Application note AN4860 Adapted Command mode page 126 (set back to Default, no change)

    are there any interrupts to set or what can be wrong?

    all the best

    terter

    edit:

    after changing the user-code block 2 to

      BSP_SDRAM_Init();

      HAL_Delay(100);

      BSP_LCD_Init();

      BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS);

      BSP_LCD_SelectLayer(1);

      BSP_LCD_DisplayOn();

      BSP_LCD_SetBackColor(LCD_COLOR_LIGHTGREEN);

      uint32_t ts_status = TS_OK;

      ts_status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize());

      BSP_LCD_Clear(LCD_COLOR_LIGHTGREEN);

      BSP_LCD_SetTextColor(LCD_COLOR_RED);

      BSP_LCD_DisplayStringAtLine(8, (uint8_t*)'  testttest42   ');

    i get now an about 800x10px high strip of flickering 'snow' on top of the lcd...

    smells somehow like sync/freq issues, but when i search for timing-related stuff in other projects

    i find nothing... are they hidden somewhere?

    many thanks for some clarification...

    terter

    edit: semi-solved

    when i comment out this part of the stm32cubeMX generated SystemClock_Config() it works!

    but what does that mean?

      //  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPDIFRX|RCC_PERIPHCLK_LTDC

      //                              |RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_USART1

      //                              |RCC_PERIPHCLK_USART6|RCC_PERIPHCLK_UART5

      //                              |RCC_PERIPHCLK_SAI1|RCC_PERIPHCLK_SAI2

      //                              |RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_I2C4

      //                              |RCC_PERIPHCLK_CLK48|RCC_PERIPHCLK_CEC;

      //  PeriphClkInitStruct.PLLI2S.PLLI2SN = 192;

      //  PeriphClkInitStruct.PLLI2S.PLLI2SP = RCC_PLLP_DIV2;

      //  PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;

      //  PeriphClkInitStruct.PLLI2S.PLLI2SQ = 2;

      //  PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;

      //  PeriphClkInitStruct.PLLSAI.PLLSAIR = 7;

      //  PeriphClkInitStruct.PLLSAI.PLLSAIQ = 8;

      //  PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV2;

      //  PeriphClkInitStruct.PLLI2SDivQ = 1;

      //  PeriphClkInitStruct.PLLSAIDivQ = 1;

      //  PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;

      //  PeriphClkInitStruct.Uart5ClockSelection = RCC_UART5CLKSOURCE_PCLK1;

      //  PeriphClkInitStruct.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;

      //  PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_PCLK1;

      //  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)

      //  {

      //    Error_Handler();

      //  }

    many thanks for some clarification...

    terter

    ps. these STM32F7 Boards are really nice but the software (stm32cubeMX , SW4STM32 ) is like a can of worms, very quirky and

    strangely the examples are not even made with stm32cubeMX. remembering having a much smother ride with the NXP1769-Expresso

    now to the next

    problem

    challenge... getting stemwin to run :)
    Roger Heil
    Associate II
    August 3, 2018

    The main problem is the template of the stm32f769-disco board. There are so many wrong values and settings done.

    1. change LED from input to output
    2. on poard the X1 is 25 MHz, the template is 8MHz (HSE)
    3. HCLK to 216MHz or what ever...
    4. Then LCD-TFT, connected to PLLSAI1/R to 27.428 (in my case ->
      1. PLLSAI1N = 384
      2. PLLSAI1R = 7 and 2
      3. set Q to 7 to get no error
    5. PLL DSI
      1. NDIV = 100
      2. IDF = 5
      3. ODF = 1
      4. -> DSI TXCLKesc = 15.625
      5. -> DSI lane byte = 62.5
    6. Set PLLSAIT1 /P to 8 to get 48MHz for the SD card

    So, the 3 frequencys are importend to get the display runnig.

    kind regards

    Roger