اطلاعیه

Collapse
No announcement yet.

مشکل در راه اندازی LCD 7 Inch با STM32F429

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

    مشکل در راه اندازی LCD 7 Inch با STM32F429

    سلام کسی هست بتونه، برای راه اندازی ال سی دی 7 اینج با بورد دیسکاوری stm32f429 راهنمایی کنه؟
    اصلا کتابخانه این ال سی دی رو از کجا میتونم گیر بیار
    نوع ال سی دی AT070TN92 هست، همونی که در فروشگاه eca موجود هست
    تنظیم کتابخانه LTDC به صورت زیره:

    LTDC_Layer_InitTypeDef LTDC_Layer_InitStruct;
    LTDC_InitTypeDef LTDC_InitStruct;

    / Enable the LTDC Clock /
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_LTDC, ENABLE);

    / Enable the DMA2D Clock /
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2D, ENABLE);

    / Configure the LCD Control pins /
    LCD_AF_GPIOConfig();

    / Configure the FMC Parallel interface : SDRAM is used as Frame Buffer for
    LCD /
    SDRAM_Init();

    / Enable Pixel Clock ------------------------------------------------------/

    / Configure PLLSAI prescalers for LCD /
    / PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz /
    / PLLSAI_VCO Output = PLLSAI_VCO Input PLLSAI_N = 384 Mhz /
    / PLLLCDCLK = PLLSAI_VCO Output/PLLSAI_R = 384/4 = 216 Mhz /
    / LTDC clock frequency = PLLLCDCLK / RCC_PLLSAIDivR = 216/2 = 48 Mhz /
    RCC_PLLSAIConfig(384, 4, 4);
    RCC_LTDCCLKDivConfig(RCC_PLLSAIDivR_Div2);

    / Enable PLLSAI Clock /
    RCC_PLLSAICmd(ENABLE);
    / Wait for PLLSAI activation /
    while(RCC_GetFlagStatus(RCC_FLAG_PLLSAIRDY) == RESET)
    {
    }

    / LTDC Initialization -----------------------------------------------------/

    / Initialize the horizontal synchronization polarity as active low/
    LTDC_InitStruct.LTDC_HSPolarity = LTDC_HSPolarity_AL;
    / Initialize the vertical synchronization polarity as active low /
    LTDC_InitStruct.LTDC_VSPolarity = LTDC_VSPolarity_AL;
    / Initialize the data enable polarity as active low /
    LTDC_InitStruct.LTDC_DEPolarity = LTDC_DEPolarity_AL;
    / Initialize the pixel clock polarity as input pixel clock /
    LTDC_InitStruct.LTDC_PCPolarity = LTDC_PCPolarity_IPC;

    / Timing configuration /
    / Configure horizontal synchronization width /
    LTDC_InitStruct.LTDC_HorizontalSync = 0; //1;
    / Configure vertical synchronization height /
    LTDC_InitStruct.LTDC_VerticalSync = 2; //3;
    / Configure accumulated horizontal back porch /
    LTDC_InitStruct.LTDC_AccumulatedHBP = 88;
    / Configure accumulated vertical back porch /
    LTDC_InitStruct.LTDC_AccumulatedVBP = 5; //3;
    / Configure accumulated active width /
    LTDC_InitStruct.LTDC_AccumulatedActiveW = (800+1+88)-1; //888
    / Configure accumulated active height /
    LTDC_InitStruct.LTDC_AccumulatedActiveH = (480+3+3)-1; //485
    / Configure total width /
    LTDC_InitStruct.LTDC_TotalWidth = (800+1+88+40)-1; //928 ---- = (800+1+88+HFP)-1 ,,,, HFP=40
    / Configure total height /
    LTDC_InitStruct.LTDC_TotalHeigh = (480+3+3+3)-1; //488 ----- =(480+3+3+VFP)-1 ,,,, VFP=3


    / Configure R,G,B component values for LCD background color /
    LTDC_InitStruct.LTDC_BackgroundRedValue = 0xFF;
    LTDC_InitStruct.LTDC_BackgroundGreenValue =0xFF;
    LTDC_InitStruct.LTDC_BackgroundBlueValue = 0xFF;

    LTDC_Init(&LTDC_InitStruct);

    / LTDC initialization end -------------------------------------------------/

    / Layer1 Configuration ----------------------------------------------------/

    / Windowing configuration /
    / In this case all the active display area is used to display a picture then:
    Horizontal start = horizontal synchronization + Horizontal back porch = 1+88
    Horizontal stop = Horizontal start + window width -1 = (88+1) + 800 -1
    Vertical start = vertical synchronization + vertical back porch = 3+3
    Vertical stop = Vertical start + window height -1 = (3+3) + 480 -1 /
    LTDC_Layer_InitStruct.LTDC_HorizontalStart = 1+88;
    LTDC_Layer_InitStruct.LTDC_HorizontalStop = (88+1) + 800 -1;
    LTDC_Layer_InitStruct.LTDC_VerticalStart = 3;
    LTDC_Layer_InitStruct.LTDC_VerticalStop = (3+3) + 480 -1;

    / Pixel Format configuration/
    LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_RGB565;

    / Alpha constant (255 totally opaque) /
    LTDC_Layer_InitStruct.LTDC_ConstantAlpha = 255;

    / Configure blending factors /
    LTDC_Layer_InitStruct.LTDC_BlendingFactor_1 = LTDC_BlendingFactor1_PAxCA;
    LTDC_Layer_InitStruct.LTDC_BlendingFactor_2 = LTDC_BlendingFactor2_PAxCA;

    / Default Color configuration (configure A,R,G,B component values) /
    LTDC_Layer_InitStruct.LTDC_DefaultColorBlue = 0;
    LTDC_Layer_InitStruct.LTDC_DefaultColorGreen = 0;
    LTDC_Layer_InitStruct.LTDC_DefaultColorRed = 0;
    LTDC_Layer_InitStruct.LTDC_DefaultColorAlpha = 0;

    / Input Address configuration /
    LTDC_Layer_InitStruct.LTDC_CFBStartAdress = LCD_FRAME_BUFFER;

    / the length of one line of pixels in bytes + 3 then :
    Line Lenth = Active high width number of bytes per pixel + 3
    Active high width = 800
    number of bytes per pixel = 2 (pixel_format : RGB565)
    /
    LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((800 2) + 3);

    / the pitch is the increment from the start of one line of pixels to the
    start of the next line in bytes, then :
    Pitch = Active high width number of bytes per pixel
    /
    LTDC_Layer_InitStruct.LTDC_CFBPitch = (800 2);

    / configure the number of lines /
    LTDC_Layer_InitStruct.LTDC_CFBLineNumber = 800;

    LTDC_LayerInit(LTDC_Layer1, &LTDC_Layer_InitStruct);

    / Layer1 Configuration end ------------------------------------------------/

    / Layer2 Configuration ----------------------------------------------------/

    / Windowing configuration /
    / In this case only 320x240 window of the active display area is used
    to display a picture then :
    Horizontal start = horizontal sync + offset_x + Horizontal back porch = 30
    Horizontal stop = Horizontal start + offset_x + window width -1 = 30 + 240 -1
    Vertical start = vertical sync + offset_y + vertical back porch = 160 + 4
    Vertical stop = Vertical start + offset_y + window height -1 = 4 + 320 -1 /
    LTDC_Layer_InitStruct.LTDC_HorizontalStart = 1+88;
    LTDC_Layer_InitStruct.LTDC_HorizontalStop = (88+1) + 800 -1;
    LTDC_Layer_InitStruct.LTDC_VerticalStart = 3;
    LTDC_Layer_InitStruct.LTDC_VerticalStop = (3+3) + 480 -1;

    / Pixel Format configuration /
    LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_RGB565;

    / Alpha constant configuration : The constant alpha for layer 2 is decreased
    to see the layer 1 in the intersection zone/
    LTDC_Layer_InitStruct.LTDC_ConstantAlpha = 255;

    / Default Color configuration (configure A,R,G,B component values) /
    LTDC_Layer_InitStruct.LTDC_DefaultColorBlue = 0;
    LTDC_Layer_InitStruct.LTDC_DefaultColorGreen = 0;
    LTDC_Layer_InitStruct.LTDC_DefaultColorRed = 0;
    LTDC_Layer_InitStruct.LTDC_DefaultColorAlpha = 0;

    / blending Factors /
    LTDC_Layer_InitStruct.LTDC_BlendingFactor_1 = LTDC_BlendingFactor1_PAxCA;
    LTDC_Layer_InitStruct.LTDC_BlendingFactor_2 = LTDC_BlendingFactor2_PAxCA;


    / Configure Input Address : frame buffer is located at FLASH memory /
    LTDC_Layer_InitStruct.LTDC_CFBStartAdress = LCD_FRAME_BUFFER+ BUFFER_OFFSET;


    / the length of one line of pixels in bytes + 3 then :
    Line Lenth = Active high width x number of bytes per pixel + 3
    Active high width = 800
    number of bytes per pixel = 2 (pixel_format : RGB565) /


    LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((800 2) + 3);
    LTDC_Layer_InitStruct.LTDC_CFBPitch = (800 2);


    / the pitch is the increment from the start of one line of pixels to the
    start of the next line in bytes, then :
    Pitch = Active high width x number of bytes per pixel
    /
    LTDC_Layer_InitStruct.LTDC_CFBLineNumber =800;


    / Initialize the Layer 2 /
    LTDC_LayerInit(LTDC_Layer2, &LTDC_Layer_InitStruct);


    / LTDC configuration reload /
    LTDC_ReloadConfig(LTDC_IMReload);

    / Enable foreground & background Layers /
    LTDC_LayerCmd(LTDC_Layer1, ENABLE);
    LTDC_LayerCmd(LTDC_Layer2, ENABLE);

    / LTDC configuration reload /
    LTDC_ReloadConfig(LTDC_IMReload);

    / Set default font /
    LCD_SetFont(&LCD_DEFAULT_FONT);

    / Layer2 Configuration end ------------------------------------------------/
    LTDC_DitherCmd(ENABLE);


    با کتاخونه زیر میخوام یه مستطیل بکشم که تنظیمات مربوط به DMA هم توش هست :


    /
    @brief Displays a full rectangle.
    [MENTION=17545]para[/MENTION]m Xpos: specifies the X position, can be a value from 0 to 240.
    [MENTION=17545]para[/MENTION]m Ypos: specifies the Y position, can be a value from 0 to 320.
    [MENTION=17545]para[/MENTION]m Height: rectangle height.
    [MENTION=17545]para[/MENTION]m Width: rectangle width.
    @retval None
    /
    void LCD_DrawFullRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
    {
    DMA2D_InitTypeDef DMA2D_InitStruct;

    uint32_t Xaddress = 0;
    uint16_t Red_Value = 0, Green_Value = 0, Blue_Value = 0;

    Red_Value = (0xF800 & CurrentTextColor) >> 11;
    Blue_Value = 0x001F & CurrentTextColor;
    Green_Value = (0x07E0 & CurrentTextColor) >> 5;

    Xaddress = CurrentFrameBuffer + 2(LCD_PIXEL_WIDTHYpos + Xpos);

    / configure DMA2D /
    DMA2D_DeInit();

    DMA2D_InitStruct.DMA2D_Mode = DMA2D_R2M;
    DMA2D_InitStruct.DMA2D_CMode = DMA2D_RGB565;
    DMA2D_InitStruct.DMA2D_OutputGreen = Green_Value;
    DMA2D_InitStruct.DMA2D_OutputBlue = Blue_Value;
    DMA2D_InitStruct.DMA2D_OutputRed = Red_Value;
    DMA2D_InitStruct.DMA2D_OutputAlpha = 0x0F;
    DMA2D_InitStruct.DMA2D_OutputMemoryAdd = Xaddress;
    DMA2D_InitStruct.DMA2D_OutputOffset = (LCD_PIXEL_WIDTH - Width);
    DMA2D_InitStruct.DMA2D_NumberOfLine = Height;
    DMA2D_InitStruct.DMA2D_PixelPerLine = Width;
    DMA2D_Init(&DMA2D_InitStruct);

    / Start Transfer /
    DMA2D_StartTransfer();

    / Wait for CTC Flag activation /
    while(DMA2D_GetFlagStatus(DMA2D_FLAG_TC) == RESET)
    {
    }


    LCD_SetTextColor(CurrentTextColor);
    }




    دوستان لطف کنین یه کمک بکنید! گیج شدم!
    ال سی دی راه میافته، لایه یک و دو تنظیم میشن، رنگ پس زمینه لایه 2 آبی میشه، ولی موقع کشید مستطیل تصویر اینجوری میشه!

    اینم تابع main:

    int main(void)
    {
    //int r,g,b;
    //uint32_t backgreen = 0;
    //uint32_t backred = 0;

    /!< At this stage the microcontroller clock setting is already configured,
    this is done through SystemInit() function which is called from startup
    file (startup_stm32f429_439xx.s) before to branch to application main.
    To reconfigure the default setting of SystemInit() function, refer to
    system_stm32f4xx.c file
    /






    / Configure LCD : Configure 2 layers w/ Blending and CLUT loading for layer 1 /
    LCD_Config();

    / LTDC reload configuration /
    LTDC_ReloadConfig(LTDC_IMReload); //

    / Enable the LTDC /
    LTDC_Cmd(ENABLE); //

    / Set LCD foreground layer /
    LCD_SetLayer(LCD_FOREGROUND_LAYER);
    LCD_SetTransparency(0);

    / Set LCD background layer /
    LCD_SetLayer(LCD_BACKGROUND_LAYER);

    / LCD display message /
    LCD_Clear(LCD_COLOR_BLUE);
    LCD_SetTextColor(LCD_COLOR_BLACK);
    LCD_DisplayStringLine(LCD_LINE_1,(uint8_t)" TEST PROGRAM ");
    LCD_DisplayStringLine(LCD_LINE_2,(uint8_t)" V1.0.1 ");
    LCD_DisplayStringLine(LCD_LINE_3,(uint8_t)" PUSH ");
    LCD_DisplayStringLine(LCD_LINE_4,(uint8_t)" USER BUTTON ");
    LCD_DisplayStringLine(LCD_LINE_5,(uint8_t)" TO START ");

    LCD_DrawLine(0, 240, 200, LCD_DIR_HORIZONTAL);
    LCD_DrawLine(0, 241, 200, LCD_DIR_HORIZONTAL);
    LCD_DrawLine(0, 242, 200, LCD_DIR_HORIZONTAL);
    LCD_DrawLine(0, 243, 200, LCD_DIR_HORIZONTAL);

    LCD_DrawFullRect(50, 50, 50, 100);

    while (1)
    {
    }
    }

    تو را دانش و دين نمايد درست در رستگاري ببايدت جست
    وگر دل نخواهي كه باشي نژند نخواهي كه دائم بوي مستمند
    به گفتار پيغمبرت راه جوي دل از تيرگي ها بدين آب شوي

    #2
    پاسخ : مشکل در راه اندازی LCD 7 Inch با STM32F429

    سلام لطفا پروژه رو زیپ کنین بذارین، با این کدها نمیشه کمک کرد. از کارکرد قسمت سخت افزار اطمینان دارین ؟؟؟

    دیدگاه


      #3
      پاسخ : مشکل در راه اندازی LCD 7 Inch با STM32F429

      نوشته اصلی توسط محمد پورخلیلی نمایش پست ها
      سلام لطفا پروژه رو زیپ کنین بذارین، با این کدها نمیشه کمک کرد. از کارکرد قسمت سخت افزار اطمینان دارین ؟؟؟
      سلام مهندش شما سمپلی چیزی درباره این موضوع نداری؟ منم دقیقا خهمین مشکلو دارم

      دیدگاه


        #4
        پاسخ : مشکل در راه اندازی LCD 7 Inch با STM32F429

        سلام
        من مشکلم حل شد. مشکل از تنظیمات رمه .تنظیمات رم رو طبق این فایل انجام بده .درست میشه

        دیدگاه


          #5
          پاسخ : مشکل در راه اندازی LCD 7 Inch با STM32F429

          نوشته اصلی توسط alizibaro نمایش پست ها
          سلام
          من مشکلم حل شد. مشکل از تنظیمات رمه .تنظیمات رم رو طبق این فایل انجام بده .درست میشه
          http://s6.picofile.com/file/8380002218/HW_Init.c.html
          من این تنظیمات رو هم انجام دادم ولی بازم به نتیجه*ای نرسیدم!
          اصلاً LCD بالا نمیاد...

          در این تاپیک هم مطرح کردم:
          با سلام و احترام خدمت دوستان؛ کسی تجربه راه*اندازی نمایشگر 7 اینچی با درایور AT070TN94 موجود در فروشگاه توسط میکروکنترلر STM32F429 (یا دیگر میکروهای CortexM4 توسط LTDC) توسط STM32CubeMX رو داره؟ مواردی که من دیدم غالبا راه*اندازی دیسکاوری بوردها بوده که خب کانفیگ*ها و کتاب*خونه*های آماده داشته. یا یه مورد هم که دیدم AT070TN94

          «پشتکار» «پشتکار» «پشتکار»

          دیدگاه

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