اطلاعیه

Collapse
No announcement yet.

سوال: راه اندازی tftlcd 7inch با استفاده از میکروکنترلر stm32f429=439 با استفاده از کتابخانه hal libray

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    سوال: راه اندازی tftlcd 7inch با استفاده از میکروکنترلر stm32f429=439 با استفاده از کتابخانه hal libray

    سلام
    من میخوام یه ال سی دی 7 اینچ رو با استفاده از توابع hal; ltdc و با میکروکنترلر stm32f429 راه اندازی کنم ( ابن میکرو ارزون ترین میکروییه که گیرم اومد و درایور داخلی ltdc داره )
    یه سرچ که کردم اکثرا با استفاده از درایورهای آماده راه اندازیش کردن و هیچ کی مستقیم با میکرو راه اندازیش نکرده .

    من دارم با IAR کد میزنم (که البته تو اصل داستان تفاوتی ایجاد نمیکنه )

    برای این کار میخوام از توابع hal استفاده کنم
    اینم فایل پروژه و کانفیگ هاش
    MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.


    و توضیحات لایبرری
    کد:
    [INDENT]
    [/INDENT]
    [FONT=Yekan][INDENT]                     ##### How to use this driver #####[/INDENT]
    [/FONT][FONT=Yekan][INDENT]  ==============================================================================[/INDENT]
    [/FONT][FONT=Yekan][INDENT]    [..][/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) Program the required configuration through the following parameters:   [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         the LTDC timing, the horizontal and vertical polarity, [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         the pixel clock polarity, Data Enable polarity and the LTDC background color value [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         using HAL_LTDC_Init() function[/INDENT]
    [/FONT][FONT=Yekan][INDENT]
    [/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) Program the required configuration through the following parameters:   [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         the pixel format, the blending factors, input alpha value, the window size [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         and the image size using HAL_LTDC_ConfigLayer() function for foreground[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         or/and background layer.     [/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) Optionally, configure and enable the CLUT using HAL_LTDC_ConfigCLUT() and [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         HAL_LTDC_EnableCLUT functions.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) Optionally, enable the Dither using HAL_LTDC_EnableDither().       [/INDENT]
    [/FONT][FONT=Yekan][INDENT]
    [/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) Optionally, configure and enable the Color keying using HAL_LTDC_ConfigColorKeying()[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         and HAL_LTDC_EnableColorKeying functions.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]
    [/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) Optionally, configure LineInterrupt using HAL_LTDC_ProgramLineEvent()[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         function[/INDENT]
    [/FONT][FONT=Yekan][INDENT]
    [/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) If needed, reconfigure and change the pixel format value, the alpha value[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         value, the window size, the window position and the layer start address [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         for foreground or/and background layer using respectively the following [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         functions: HAL_LTDC_SetPixelFormat(), HAL_LTDC_SetAlpha(), HAL_LTDC_SetWindowSize(),[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         HAL_LTDC_SetWindowPosition(), HAL_LTDC_SetAddress.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]
    [/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) Variant functions with ԟNoReloadԠpost fix allows to set the LTDC configuration/settings without immediate reload.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         This is useful in case when the program requires to modify serval LTDC settings (on one or both layers) [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         then applying(reload) these settings in one shot by calling the function ԈAL_LTDC_Reloadԍ[/INDENT]
    [/FONT][FONT=Yekan][INDENT]
    [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         After calling the ԟNoReloadԠfunctions to set different color/format/layer settings, [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         the program can call the function  ԈAL_LTDC_ReloadԠTo apply(Reload) these settings. [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         Function ԈAL_LTDC_ReloadԠcan be called with the parameter  ԒeloadTypeԠ[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         set to LTDC_RELOAD_IMMEDIATE if an immediate reload is required.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         Function ԈAL_LTDC_ReloadԠcan be called with the parameter  ԒeloadTypeԠ[/INDENT]
    [/FONT][FONT=Yekan][INDENT]         set to LTDC_RELOAD_VERTICAL_BLANKING if the reload should be done in the next vertical blanking period, [/INDENT]
    [/FONT][FONT=Yekan][INDENT]         this option allows to avoid display flicker by applying the new settings during the vertical blanking period.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]     (#) To control LTDC state you can use the following function: HAL_LTDC_GetState()               [/INDENT]
    [/FONT][FONT=Yekan][INDENT]
    [/INDENT]
    [/FONT][FONT=Yekan][INDENT]     *** LTDC HAL driver macros list ***[/INDENT]
    [/FONT][FONT=Yekan][INDENT]     ============================================= [/INDENT]
    [/FONT][FONT=Yekan][INDENT]     [..][/INDENT]
    [/FONT][FONT=Yekan][INDENT]       Below the list of most used macros in LTDC HAL driver.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_ENABLE: Enable the LTDC.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_DISABLE: Disable the LTDC.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_LAYER_ENABLE: Enable a LTDC Layer.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_LAYER_DISABLE: Disable a LTDC Layer.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_CLEAR_FLAG: Clear the LTDC pending flags.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_ENABLE_IT: Enable the specified LTDC interrupts. [/INDENT]
    [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_DISABLE_IT: Disable the specified LTDC interrupts.[/INDENT]
    [/FONT][FONT=Yekan][INDENT]     [..] 
    [/INDENT]
    [/FONT][INDENT]
    [/INDENT]
    اگه دوستان تجربه ای توی این زمینه داره لطفا به اشتراک بگذاره وگرنه دوستان یه کمک برسونن راهش بندازیم تو این تاپیک

    #2
    پاسخ : سوال: راه اندازی tftlcd 7inch با استفاده از میکروکنترلر stm32f429=439 با استفاده از کتابخانه hal libray

    خب من یه قدم جلو برم دوستان لطفا یه کمک کنید .
    اولین قدمش init کردن ال سی دی هست
    کد:
    HAL_LTDC_Init(&hltdc)
    HAL_LTDC_ConfigLayer
    خب این تابع رو اینجوری کانفیگ کرده :
    کد:
      LTDC_LayerCfgTypeDef pLayerCfg = {0};
      LTDC_LayerCfgTypeDef pLayerCfg1 = {0};
    
    
      /* USER CODE BEGIN LTDC_Init 1 */
    
    
      /* USER CODE END LTDC_Init 1 */
      hltdc.Instance = LTDC;
      hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;   //0x00000000U active low 
      hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;   //0x00000000U active low 
      hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;   //0x00000000U active low 
      hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;  //0x00000000U active low 
      hltdc.Init.HorizontalSync = 7;
      hltdc.Init.VerticalSync = 3;
      hltdc.Init.AccumulatedHBP = 14;
      hltdc.Init.AccumulatedVBP = 5;
      hltdc.Init.AccumulatedActiveW = 654;
      hltdc.Init.AccumulatedActiveH = 485;
      hltdc.Init.TotalWidth = 660;
      hltdc.Init.TotalHeigh = 487;
      hltdc.Init.Backcolor.Blue = 0;
      hltdc.Init.Backcolor.Green = 0;
      hltdc.Init.Backcolor.Red = 0;
      if (HAL_LTDC_Init(&hltdc) != HAL_OK)
      {
        Error_Handler();
      }
      pLayerCfg.WindowX0 = 0;
      pLayerCfg.WindowX1 = 0;
      pLayerCfg.WindowY0 = 0;
      pLayerCfg.WindowY1 = 0;
      pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;//0x00000000U
      pLayerCfg.Alpha = 0;
      pLayerCfg.Alpha0 = 0;
      pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;//0x00000400U
      pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;//0x00000005U
      pLayerCfg.FBStartAdress = 0;
      pLayerCfg.ImageWidth = 0;
      pLayerCfg.ImageHeight = 0;
      pLayerCfg.Backcolor.Blue = 0;
      pLayerCfg.Backcolor.Green = 0;
      pLayerCfg.Backcolor.Red = 0;
      if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
      {
        Error_Handler();
      }
      pLayerCfg1.WindowX0 = 0;
      pLayerCfg1.WindowX1 = 0;
      pLayerCfg1.WindowY0 = 0;
      pLayerCfg1.WindowY1 = 0;
      pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;
      pLayerCfg1.Alpha = 0;
      pLayerCfg1.Alpha0 = 0;
      pLayerCfg1.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;0x00000400U
      pLayerCfg1.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;0x00000005U
      pLayerCfg1.FBStartAdress = 0;
      pLayerCfg1.ImageWidth = 0;
      pLayerCfg1.ImageHeight = 0;
      pLayerCfg1.Backcolor.Blue = 0;
      pLayerCfg1.Backcolor.Green = 0;
      pLayerCfg1.Backcolor.Red = 0;
      if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg1, 1) != HAL_OK)
      {
        Error_Handler();
      }
    فقط چند تا سوال پیش میاد
    جدیدترین ویرایش توسط hamedtahamtan; ۱۵:۳۱ ۱۳۹۹/۰۲/۰۹.

    دیدگاه


      #3
      پاسخ : سوال: راه اندازی tftlcd 7inch با استفاده از میکروکنترلر stm32f429=439 با استفاده از کتابخانه hal libray

      نوشته اصلی توسط hamedtahamtan نمایش پست ها
      سلام
      من میخوام یه ال سی دی 7 اینچ رو با استفاده از توابع hal; ltdc و با میکروکنترلر stm32f429 راه اندازی کنم ( ابن میکرو ارزون ترین میکروییه که گیرم اومد و درایور داخلی ltdc داره )
      یه سرچ که کردم اکثرا با استفاده از درایورهای آماده راه اندازیش کردن و هیچ کی مستقیم با میکرو راه اندازیش نکرده .

      من دارم با IAR کد میزنم (که البته تو اصل داستان تفاوتی ایجاد نمیکنه )

      برای این کار میخوام از توابع hal استفاده کنم
      اینم فایل پروژه و کانفیگ هاش
      MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.


      و توضیحات لایبرری
      کد:
      [INDENT]
      [/INDENT]
      [FONT=Yekan][INDENT]                     ##### How to use this driver #####[/INDENT]
      [/FONT][FONT=Yekan][INDENT]  ==============================================================================[/INDENT]
      [/FONT][FONT=Yekan][INDENT]    [..][/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) Program the required configuration through the following parameters:   [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         the LTDC timing, the horizontal and vertical polarity, [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         the pixel clock polarity, Data Enable polarity and the LTDC background color value [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         using HAL_LTDC_Init() function[/INDENT]
      [/FONT][FONT=Yekan][INDENT]
      [/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) Program the required configuration through the following parameters:   [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         the pixel format, the blending factors, input alpha value, the window size [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         and the image size using HAL_LTDC_ConfigLayer() function for foreground[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         or/and background layer.     [/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) Optionally, configure and enable the CLUT using HAL_LTDC_ConfigCLUT() and [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         HAL_LTDC_EnableCLUT functions.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) Optionally, enable the Dither using HAL_LTDC_EnableDither().       [/INDENT]
      [/FONT][FONT=Yekan][INDENT]
      [/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) Optionally, configure and enable the Color keying using HAL_LTDC_ConfigColorKeying()[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         and HAL_LTDC_EnableColorKeying functions.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]
      [/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) Optionally, configure LineInterrupt using HAL_LTDC_ProgramLineEvent()[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         function[/INDENT]
      [/FONT][FONT=Yekan][INDENT]
      [/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) If needed, reconfigure and change the pixel format value, the alpha value[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         value, the window size, the window position and the layer start address [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         for foreground or/and background layer using respectively the following [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         functions: HAL_LTDC_SetPixelFormat(), HAL_LTDC_SetAlpha(), HAL_LTDC_SetWindowSize(),[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         HAL_LTDC_SetWindowPosition(), HAL_LTDC_SetAddress.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]
      [/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) Variant functions with ԟNoReloadԠpost fix allows to set the LTDC configuration/settings without immediate reload.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         This is useful in case when the program requires to modify serval LTDC settings (on one or both layers) [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         then applying(reload) these settings in one shot by calling the function ԈAL_LTDC_Reloadԍ[/INDENT]
      [/FONT][FONT=Yekan][INDENT]
      [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         After calling the ԟNoReloadԠfunctions to set different color/format/layer settings, [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         the program can call the function  ԈAL_LTDC_ReloadԠTo apply(Reload) these settings. [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         Function ԈAL_LTDC_ReloadԠcan be called with the parameter  ԒeloadTypeԠ[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         set to LTDC_RELOAD_IMMEDIATE if an immediate reload is required.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         Function ԈAL_LTDC_ReloadԠcan be called with the parameter  ԒeloadTypeԠ[/INDENT]
      [/FONT][FONT=Yekan][INDENT]         set to LTDC_RELOAD_VERTICAL_BLANKING if the reload should be done in the next vertical blanking period, [/INDENT]
      [/FONT][FONT=Yekan][INDENT]         this option allows to avoid display flicker by applying the new settings during the vertical blanking period.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]     (#) To control LTDC state you can use the following function: HAL_LTDC_GetState()               [/INDENT]
      [/FONT][FONT=Yekan][INDENT]
      [/INDENT]
      [/FONT][FONT=Yekan][INDENT]     *** LTDC HAL driver macros list ***[/INDENT]
      [/FONT][FONT=Yekan][INDENT]     ============================================= [/INDENT]
      [/FONT][FONT=Yekan][INDENT]     [..][/INDENT]
      [/FONT][FONT=Yekan][INDENT]       Below the list of most used macros in LTDC HAL driver.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_ENABLE: Enable the LTDC.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_DISABLE: Disable the LTDC.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_LAYER_ENABLE: Enable a LTDC Layer.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_LAYER_DISABLE: Disable a LTDC Layer.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_CLEAR_FLAG: Clear the LTDC pending flags.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_ENABLE_IT: Enable the specified LTDC interrupts. [/INDENT]
      [/FONT][FONT=Yekan][INDENT]      (+) __HAL_LTDC_DISABLE_IT: Disable the specified LTDC interrupts.[/INDENT]
      [/FONT][FONT=Yekan][INDENT]     [..] 
      [/INDENT]
      [/FONT][INDENT]
      [/INDENT]
      اگه دوستان تجربه ای توی این زمینه داره لطفا به اشتراک بگذاره وگرنه دوستان یه کمک برسونن راهش بندازیم تو این تاپیک
      سلام
      میتونی از این آموزش استفاده کنی . موفق باشید

      [APARAT][https://www.aparat.com/v/wmPya/APARAT]

      دیدگاه

      لطفا صبر کنید...
      X