0

STM32CubeF7 の BSP ライブラリを使用して stm32f769i-disco の LED に文字列を表示しようとしています。しかし、何も起こりません。コードは次のとおりです。

#include "stm32f7xx_hal.h"
#include "stm32f769i_discovery.h"
#include "stm32f769i_discovery_lcd.h"
#include "stm32f7xx.h"
#include <stdio.h>

char str[] = "Hello from BSP LCD demo!";

void LCDInit() {
    // Initialize the LCD using the BSP_LCD_Init() function.
    BSP_LCD_Init();

    // Select the LCD layer to be used using the BSP_LCD_SelectLayer() function.
    //BSP_LCD_SelectLayer(0);
    BSP_LCD_LayerDefaultInit(LTDC_DEFAULT_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
    BSP_LCD_SelectLayer(LTDC_DEFAULT_ACTIVE_LAYER);

    // Enable the LCD display using the BSP_LCD_DisplayOn() function.
    BSP_LCD_DisplayOn();

    // Clear the whole LCD using BSP_LCD_Clear() function or only one specified string line using the BSP_LCD_ClearStringLine() function.
    BSP_LCD_Clear(LCD_COLOR_LIGHTGRAY);
    HAL_Delay(1000);

    BSP_LCD_SetBackColor(LCD_COLOR_LIGHTGRAY);
    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);

    // Display a character on the specified line and column using the BSP_LCD_DisplayChar() function or a complete string line using the BSP_LCD_DisplayStringAtLine() function.
    BSP_LCD_DisplayStringAt(100, 100, str, CENTER_MODE);
}

int main(void) {
    LCDInit();
    BSP_LED_Init(LED_GREEN);

    while(1) {
        for (int i=0;i<1000000;i++);
        BSP_LED_Toggle(LED_GREEN);
    }

    return 0;
}

LCDInit への呼び出しを削除すると、LED がトグルし、LCDInit を呼び出しても何も起こらず (LED はトグルしません)、LCD は黒のままです。何か案は?

私は基本的に stm32f769i_discovery_lcd.c の指示に従ってみましたが、運が悪かったです:

2. Driver description:
---------------------
  + Initialization steps:
     o Initialize the LCD using the BSP_LCD_Init() function.
     o Select the LCD layer to be used using the BSP_LCD_SelectLayer() function.
     o Enable the LCD display using the BSP_LCD_DisplayOn() function.

  + Options
     o Configure and enable the color keying functionality using the
       BSP_LCD_SetColorKeying() function.
     o Modify in the fly the transparency and/or the frame buffer address
       using the following functions:
       - BSP_LCD_SetTransparency()
       - BSP_LCD_SetLayerAddress()

  + Display on LCD
     o Clear the whole LCD using BSP_LCD_Clear() function or only one specified string
       line using the BSP_LCD_ClearStringLine() function.
     o Display a character on the specified line and column using the BSP_LCD_DisplayChar()
       function or a complete string line using the BSP_LCD_DisplayStringAtLine() function.
     o Display a string line on the specified position (x,y in pixel) and align mode
       using the BSP_LCD_DisplayStringAtLine() function.
     o Draw and fill a basic shapes (dot, line, rectangle, circle, ellipse, .. bitmap)
       on LCD using the available set of functions.

編集: OpenOCD でデバッグする場合、BSP_LCD_Init() 行にブレークポイントを設定すると gdb がハングします。デバッガーを再度実行すると、プログラムが WWDG_IRQHandler () で停止していることがわかります。

4

1 に答える 1